Jav_Rock
Jav_Rock

Reputation: 22245

Possible bug in OpenCV2.4 capturing frames from video

Could it be that there is a bug in OpenCV2.4 highgui for capturing frames from video in windows?

I installed both the precompiled libraries, the ones compiled by me, I can compile everything perfectly and I can run my programs if

they are image based. The problem is only for videos. OpenCV crashes in this function always:

 virtual IplImage* retrieveFrame(int)
    {
        unsigned char* data = 0;
        int step=0, width=0, height=0, cn=0;

        if(!ffmpegCapture ||
           !icvRetrieveFrame_FFMPEG_p(ffmpegCapture,&data,&step,&width,&height,&cn)) <-------CRASHES HERE
           return 0;
        cvInitImageHeader(&frame, cvSize(width, height), 8, cn);
        cvSetData(&frame, data, step);
        return &frame;
    }

This is inside the class cap_ffmpeg.cpp and is called by VideoCapture.

I tried versions 2.4.2 and 2.4.9. My programes were working finde with opencv2


More information

EDIT

It looks like it is actually a bug, so, how can I solve this problem and change my code to be able to read avi files?

Upvotes: 5

Views: 847

Answers (3)

Prasaathviki
Prasaathviki

Reputation: 1167

if your using x64. Please use opencv_ffmpeg245_64.dll this solves may solve the problem. Or rename opencv_ffmpeg245_64.dll to opencv_ffmpeg245.dll may solve the problem.

Upvotes: 1

Dan
Dan

Reputation: 61

I had similar problem. I downloaded VirtualDub, but it did not open one of my avi video because of its FMP4 encode. So in the end, the solution that solved the problem was to install ffdshow, a decoder for windows. See this link: http://www.moviecodec.com/video-codecs/fmp4-codec-with-virtualdub-45814/

Then I do not need to use VirtualDub anymore to re-encode my video anymore!

Upvotes: 1

Jav_Rock
Jav_Rock

Reputation: 22245

As a temporary solution I decided to re-encode the videos so OpenCV doesn't use the ffmpeg. I used VirtualDub with the microsoft video 1 compression, which uses "msvidc32.dll" driver.

It works with all my videos so it is enough by now as I can keep working with OpenCV in windows.

enter image description here

Upvotes: 5

Related Questions