Videocapture problem on Linux

asked 2014-05-16 22:18:48 -0600

unxnut gravatar image

updated 2014-05-17 20:22:36 -0600

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.

edit retag flag offensive close merge delete

Comments

Instead of the open function, try declaring it as

  cv::VideoCapture video('location_of_file');

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 :)

StevenPuttemans gravatar imageStevenPuttemans ( 2014-05-19 03:36:05 -0600 )edit

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.

unxnut gravatar imageunxnut ( 2014-05-19 08:31:29 -0600 )edit

hmm relative path could already be your problem... first make sure an absolute path works.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-05-19 08:33:01 -0600 )edit

Tried "./" and the absolute path starting with root. No luck.

unxnut gravatar imageunxnut ( 2014-05-19 09:54:27 -0600 )edit