Ask Your Question

Revision history [back]

VideoWriter issue: class not opening. (c++ with windows8)

Hello.

I am trying to record a video using openCV's class VideoWriter.

Using the following function,

void addFrameToVideo(Mat& frame)
{
    if(_vid.open("test.avi", CV_FOURCC('M','J','P','G'), 30, frame.size(), 1))
        cout << "here" << endl;

    _vid.write(frame);
}

_vid is a variable of type VideoWriter and I can imshow frame with no problems.

The if condition never verifies, since the program never outputs "here". However, this code actually creates a "test.avi" file in the directory, but it remains empty. I've tried several different compression methods with no success.

Any thoughts?