When I used python audio segment to open a .wav file and divide it into many .wav files i am getting this error
"C:\Python27\lib\site-packages\pydub\utils.py:165: RuntimeWarning: Couldn't find
ffmpeg or avconv - defaulting to ffmpeg, but may not work
warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work"
, RuntimeWarning)"
It seems like you don't have ffmpeg, which is listed in the dependencies section of the Pydub GitHub. However, it is only required if you wish to load or save non-WAV files.
This message is just a warning, if you're using Pydub solely for WAV files, it is safe to simply ignore it.
Related
I am creating a project in c++ with QtCreator (5.14.1, MingGW compiler) and trying to use OpenCv (3.4.16) to read video files. I have tried many files of standard formats and codecs (H.264, yuv420, .mov etc). However, no matter what I try, VideoCapture() always silently fails. It doesn’t crash or show any error code, instead isOpened() is just always false.
I think the cause is that I am building opencv (via this tutorial https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows) without internet connection (I cannot have internet connection on this machine, so please do not ask me to) and therefore it can’t download the FFMPEG libraries during this process. I have been looking everywhere for information about how to download the FFMPEG libraries for opencv directly but I haven’t had any luck.
Can someone please explain what libraries I need to download and how opencv goes about looking for them? because at the moment I don’t know what I need, nor where to put them, and I cant find any information on the topic.
Or, can someone explain why calling VideoCapture(“video.mov”, cv::CAP_ANY) doesn’t have any effect? (despite being able to play the video easily in VLC, MediaPlayer etc).
Code:
`
int main()
{
VideoCapture cap(“C://video.mov”);
//VideoCapture cap(“C:/video.mov”);
//VideoCapture cap(“C:\video.mov”);
//VideoCapture cap(“C:\video.mov”);
if (!cap.isOpened()){
cout << "Error opening video stream or file"<< endl;
return -1;
}
}
`
I have tried downloading some ffmpeg DLLs and the EXEs and adding them to the PATH, no success. I have also tried downloading the shared GPL of ffmpeg (that comes with the libs and include) and added them my .pro file but no change in VideoCapture behavior.
I have also tried moving the opencv_ffmpeg_64.dll (found in opencv/build/bin) to my executable directory but that didn't fix anything.
In the end I used this guys answer,
How do i compile opencv_ffmpeg.dll file using mingw on windows 10 64 bit?
Just note that some of the directories are a little different now. You don't need to put them in a folder named after the hash, or in a 'download' subdirectory, and you need to copy all of them to opencv-build/3rd party/ffmpeg/. I also put them in opencv/source/3rd party/ffmpeg, but not sure if I needed to do that. Finally you need to go into the ffmpeg.cmake file and set 'status' to TRUE when the download fails (or just remove the download part altogether), this lets it call ffmpeg_version.cmake and set things up.
I downloaded the files from the timit speech corpus found here: https://github.com/philipperemy/timit
When I try playing the .WAV files with groove music or windows media player I get an error saying the file cannot be played.
However after converting the file to mp3 using an online converter, the file suddenly works.
The .WAV files are only around 100-200KB in size.
Does anyone know what the reason for this problem might be?
Found the answer here: reading a WAV file from TIMIT database in python
Apparently it is not actually a .WAV file but a NIST file.
Am trying to convert .264 files to mp4 or avi or wav format.
I have tried ffmpeg but no luck.
I am using python 2.7 on windows 7.
Please help!!
If you have a .264 file I would suggest to wrap it in a mp4 container (no re-encode required that way).
Try the following:
ffmpeg -i INPUT.h264 -c:v copy OUTPUT.mp4
Moreover, .264 contains video only so there's no way you're gonna convert it to WAV which contains audio only.
I use this code to create an mkv file with a webm video:
Code
The video that is generated can be opened in vlc and mplayer, however, firefox sais: video can't be played because the file is corrupt
How do I have to change the header so I can open it in firefox, too?
Found the solution... this code actually outputs a so called ivf format, while the real mkv output code can be found here:
(Much more complicated, though)
I'm currently working on converting h.264 elementary stream (file with postfiix .264) to transport stream (file with postfix .ts). I have finished the conversion successfully using ffmpeg command line "ffmpeg -i in.264 -an -vcodec copy -f mpegts out.ts".
Now I want to implement this conversion using my own C++ code, by calling ffmpeg's libraries. I have downloaded precompiled ffmpeg libraries (libavcodec, libavformat etc). My input h.264 is prerecorded file, not live stream, and so as my output .ts file. So my question is which functions in the library should I call to implement the conversion?
You will see an example file named ffmpeg.c after you install ffmpeg in Linux. There are many options to set the decoding parameters in this file e.g. opt_audio_codec, opt_video_codec, opt_audio_rate, opt_video_rate, opt_default etc. Just set the necessary parameters from your command(-i in.264 -an -vcodec copy -f mpegts out.ts) using appropriate functions before calling "transcode" or "av_encode" function from "main" function of ffmpeg.c file.
It's not as simple as list the library calls. Here is an old tutorial that will help you get started reading the input file. There is also an example called decoding_encoding.c that is included with the ffmpeg source. These should help you get started.
You don't need to do it in your own code. You can just spawn the ffmpeg process programatically instead. Use CreateProcess on Windows, or spawn on Linux.