Videocapture problem on Linux
I am trying to write a program that just reads and displays videos. The code runs fine on Windows but not on Linux. My Linux environment is Centos (and Red Hat on a different machine), both 64-bit versions. I have built OpenCV 2.4.9, and made sure that FFMPEG is enabled. In fact, I built FFMPEG from tarball on the Red Hat machine and the install put the libav* files in /usr/local/lib. I have tried to step through the code and it says that when I create the VideoCapture
object, the object is invalid. I am completely baffled and will appreciate any ideas on what could be wrong.
On the same machine (and in the same code), I have been able to read a still JPEG image and display it without any issue.
Here is some more information.
(gdb) n
22 video.open ( VIDEO );
(gdb) p video
$1 = <incomplete type>
(gdb)
Notice that I am trying to print the contents of video
just before it has opened a video file. At this point, the only statement executed is cv::VideoCapture video;
. So, it looks like the system does not like the declaration for some reason.
Instead of the open function, try declaring it as
I have experienced similar problems with the open functionality. As to the fact this all works on windows but not on redhat, sure you are using front slashes? Since backslashes and linux is a nogo :)
I tried your suggestion as well as the first attempt. That did not work. That is why I tried to create a variable and examine that it was appropriately created. I am using relative path and so, there is no slash/backslash issue. This is a fresh install of 2.4.9 on a newly built machine and other OpenCV functions are working correct.
hmm relative path could already be your problem... first make sure an absolute path works.
Tried "./" and the absolute path starting with root. No luck.