Problem with reading video file opencv 3.1 [closed]

asked 2015-12-29 11:32:06 -0500

valentine gravatar image

Hi All,

I just recently installed opencv3.1 and i wanted to read a video file. Everything seem fine to as i have used code before. Please anyone look at this:

VideoCapture capture;

while (1) {"C:/Users/hp/Documents/motionTrackingTutorial/bouncingBall.avi");

    if (!capture.isOpened()) {
        cout << "ERROR ACQUIRING VIDEO FEED\n";
        return -1;

          // ...............other code are implemented here

The video file is not read as "ERROR ACQUIRING VIDEO FEED" is been displayed. Please can anyone help.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-09-27 11:31:02.611368

Comments"C:/Users/hp/Documents/motionTrackingTutorial/bouncingBall.avi"); should be before while

LBerger gravatar imageLBerger ( 2015-12-29 13:21:15 -0500 )edit

Hi LBerger, tried that still did not work.

valentine gravatar imagevalentine ( 2015-12-29 13:28:55 -0500 )edit

You have got an example in samples/cpp/starter_video.cpp. You can try this example :

cpp-example-starter_video.exe f:/lib/opencv/samples/data/768x576.avi

If it works try with your video (I have installed opencv in f:/lib)

LBerger gravatar imageLBerger ( 2015-12-29 13:53:55 -0500 )edit

Hi LBerger,

The example in starter_video.cpp still fails read from the video file and then opens my webcam as seen from the code snippet below:

VideoCapture capture(arg); //try to open string, this will attempt to open it as a video file or image sequence
if (!capture.isOpened()) //if this fails, try to open as a video camera, through the use of an integer param;er code here
valentine gravatar imagevalentine ( 2015-12-29 14:23:03 -0500 )edit

Copy 768x576.avi in folder where is exe file like this you can check problem with path name :

cpp-example-starter_video.exe 768x576.avi

After to open this video you will need opencv_ffmpeg310_64.dll. If opencvcannot find this dll there is no error message. You can check if everything is OK using "depends"

LBerger gravatar imageLBerger ( 2015-12-29 14:36:13 -0500 )edit

Hi LBerger,

I found a way around this, it was resolved by adding the path to opencv_ffmpeg310_64.dll to my path variable. All was history.

Thanks for your response.

valentine gravatar imagevalentine ( 2015-12-30 02:14:19 -0500 )edit