开发者

cvQueryFrame() returns NULL before end of file

开发者 https://www.devze.com 2023-04-07 12:03 出处:网络
I\'m trying to process large AVI files (approx. 61000 frames, 505MB) with OpenCV, using cvCaptureFromAVI() and cvQueryFrame().

I'm trying to process large AVI files (approx. 61000 frames, 505MB) with OpenCV, using cvCaptureFromAVI() and cvQueryFrame().

However, cvQueryFrame() returns a NULL pointer before it reaches the last frame of the avi.

long int numframe = 6000;
while (numframe < 67000)
{        
    frame = cvQueryFrame( capture );
    if (! frame)
    {
        fprintf(stderr, "could not query the frame %ld.\n", numframe);
        break;
    }

    char namefile[250];
    sprintf( namefile, "/media/6E86F8CB03A4DFA4/image-sequence/%ld.jpg", numframe );
    cvSaveImage( namefile, frame ); // save frame as a image

    numframe++;
}

Has anyone else has had the same problem and found a way aro开发者_Go百科und it? Is there something that I can do?


Most probably you are experienced one of the FFMPEG integration bugs. This bugreport looks very similar to your problem.

What version of OpenCV are you using?

Any way I recommend you:

  1. Try another version of OpenCV

  2. Try to build OpenCV without FFMPEG. Probably OpenCV will be able to read your file with VfW or GStreamer.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号