Ask Your Question
0

cvCreateFileCapture does not work

asked 2012-07-05 17:08:30 -0500

dherms gravatar image

updated 2018-10-28 20:49:56 -0500

Hi,

I recently reloaded Ubuntu 12.04 onto my computer and have been trying to get my previously working OpenCV code to run again. It compiles, but cvCreateFileCapture always returns null with the video I am sending it. I checked and the video is definitely present (I used absolute path). I made sure FFMPEG and libav-tools were properly installed like many other forums suggested. Even when I would uninstall and reinstall OpenCV, I would see that the CMake configuration output recognizes FFMPEG.

Unfortunately, I do not remember the version of OpenCV I had before when it worked. How do I get this working?

Thanks!

Update 7 JUL 2012: Output from ./opencv_test_highgui, the test function provided with OpenCV:

[==========] Running 17 tests from 4 test cases.
[----------] Global test environment set-up.
[----------] 3 tests from Highgui_Drawing
[ RUN      ] Highgui_Drawing.cpp_regression
[       OK ] Highgui_Drawing.cpp_regression (5 ms)
[ RUN      ] Highgui_Drawing.c_regression
[       OK ] Highgui_Drawing.c_regression (7 ms)
[ RUN      ] Highgui_Drawing.fillconvexpoly_clipping
[       OK ] Highgui_Drawing.fillconvexpoly_clipping (0 ms)
[----------] 3 tests from Highgui_Drawing (12 ms total)

[----------] 8 tests from Highgui_Video
[ RUN      ] Highgui_Video.seek_progressive
/home/dherms/OpenCV-2.4.2/modules/ts/src/ts.cpp:514: Failure
Failed

    failure reason: Invalid test data
    test case #-1
    seed: ffffffffffffffff
-----------------------------------
    LOG: 

Source files directory: video/

Reading video file in video/big_buck_bunny.avi...

File information (video 1): 

Name: big_buck_bunny.avi
FAILED

Error: cannot read source video file.

Reading video file in video/big_buck_bunny.mov...

File information (video 2): 

Name: big_buck_bunny.mov
FAILED

Error: cannot read source video file.

Reading video file in video/big_buck_bunny.mp4...

File information (video 3): 

Name: big_buck_bunny.mp4
FAILED

Error: cannot read source video file.

Reading video file in video/big_buck_bunny.mpg...

File information (video 4): 

    Name: big_buck_bunny.mpg
FAILED

Error: cannot read source video file.

Successfull experiments: 0 (0%)
Failed experiments: 4 (100%)

-----------------------------------

[  FAILED  ] Highgui_Video.seek_progressive (24 ms)
[ RUN      ] Highgui_Video.seek_random
/home/dherms/OpenCV-2.4.2/modules/ts/src/ts.cpp:514: Failure
Failed

    failure reason: Invalid test data
    test case #-1
    seed: ffffffffffffffff
-----------------------------------
    LOG: 

Source files directory: video/

Reading video file in video/big_buck_bunny.avi...

File information (video 1): 

Name: big_buck_bunny.avi
FAILED

Error: cannot read source video file.

Reading video file in video/big_buck_bunny.mov...

File information (video 2): 

Name: big_buck_bunny.mov
FAILED

Error: cannot read source video file.

Reading video file in video/big_buck_bunny.mp4...

File information (video 3): 

Name: big_buck_bunny.mp4
FAILED

Error: cannot read source video file.

Successfull experiments: 1 (25%)
Failed experiments: 3 (75%)

-----------------------------------

[  FAILED  ] Highgui_Video.seek_random (0 ms)
[ RUN      ] Highgui_Video.framecount
/home/dherms/OpenCV-2.4.2/modules/ts/src/ts.cpp:514: Failure
Failed

    failure reason: Invalid test data
    test case #-1
    seed: ffffffffffffffff
-----------------------------------
    LOG: 

Source files directory: video/

File information (video 1): 

Name: big_buck_bunny.avi
FAILED

Error: cannot read source video file.

-----------------------------------

[  FAILED  ] Highgui_Video.framecount (0 ms)
[ RUN      ] Highgui_Video.seek_random_synthetic
/home/dherms/OpenCV-2.4.2/modules/ts/src/ts.cpp:514: Failure
Failed

    failure reason: Hardware/OS exception
    test case #-1
    seed: ffffffffffffffff
-----------------------------------
    LOG: 
File: /tmp/__opencv_temp.XmoSAj.XVID.avi

-----------------------------------

[  FAILED  ] Highgui_Video.seek_random_synthetic (1 ms)
[ RUN      ] Highgui_Video.regression
/home/dherms/OpenCV-2.4.2/modules/ts ...
(more)
edit retag flag offensive close merge delete

Comments

the C API is definitely not well supported anymore, please use a cv::VideoCapture. Also, maybe you don't have all the right codecs installed ? Install ubuntu-restricted-extras

Vincent Rabaud gravatar imageVincent Rabaud ( 2012-07-05 18:10:31 -0500 )edit

Tried to install FFMPEG 0.11.1 and its having some errors of its own that I cannot solve. I installed the newest version of FFMPEG from their git repo, as well as ubuntu-restricted-extras, but my program still wouldn't work. I then changed my functions to run the C++ API functions rather than C, but I am now getting a segmentation fault when I call VideoCapture::open rather then a NULL pointer when I called cvCreateFileCapture.

dherms gravatar imagedherms ( 2012-07-07 17:47:35 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-07-05 17:19:10 -0500

AlexanderShishkov gravatar image

Try to compile and install FFMPEG 0.11*

edit flag offensive delete link more

Comments

Good answer would use on this Site

card0z0 gravatar imagecard0z0 ( 2016-10-04 13:24:18 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2012-07-05 17:08:30 -0500

Seen: 3,595 times

Last updated: Jul 07 '12