Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

VideoWriter VideoCapture and uncompressed AVI

Hi everyone,

I think a similar issue is reported in a previous unanswered discussion. But I prefer to report my issue with more details. Anyway, I have a problem with cv::VideoCapture when grabbing frames from an uncompressed AVI file created using cv::VideoWriter. Basically the video seems ok when it's played with WMP for instance, but the frames are corrupted when grabbed using cv::VideoCapture (a snapshot here).

I'm using OpenCV 2.4.1, built in Windows 7 using Visual Studio 2010, x86, WITH_VIDEOINPUT=ON and WITH_FFMPEG=OFF. Here's a quick code sample:

int main()
    VideoCapture camera(0);
    VideoWriter writer("test.avi", 0, 30.0, Size(640, 480), true);

    int count = 0;
    while (count++ < 90)
        Mat frm;
        camera >> frm;
        writer << frm;
        imshow("Frame recorded", frm);


    VideoCapture video("test.avi");
    Mat frm;
    while (
        imshow("Frame grabbed", frm);
    return 0;

I checked the issue tracker, and the change-log of the latest version, but this problems seems not to be mentioned. So, I suppose I'm missing something. Any help is appreciated! Thanks in advance,