Reputation: 1191
I am trying to open a video file qith video capture. I have compiled it on VS10 and it is ok. but when I compile it on linux (ubuntu 11.10) and try to run it, it does not open the file and it is not giving any errors or warnings either.
Here is the code:
int main(int argc, char** argv)
{
if (argc < 2)
{
std::cout << "Usage: " << argv[0] << " <input.avi>" << std::endl;
exit(1);
}
// Video Capture:
VideoCapture capture(argv[1]);
if(!capture.isOpened())
{
printf("Failed to open %s\nExiting ...\n",argv[1]);
exit (1);
}
return 0;
}
And it always outputs "Filed to open". what could be the problem?
Upvotes: 0
Views: 11297
Reputation: 18477
Even I had the same problem. I hadn't configured ffmpeg properly. Look at this question
VideoCapture is not working in OpenCV 2.4.2
You need to configure ffmpeg properly.
For ffmpeg,
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab
make
sudo make install
Upvotes: 3