Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

VideoWriter produces empty wmv

I am attempting to write to a wmv file, but the following code produces a empty file.

Mat frame;
m_cam->read(frame);
imshow("Stimulus Mode", frame);
if(m_recording && m_videoFile != NULL){
    m_videoFile->write(frame);
}

The code that opens the file is:

            m_videoFile = new VideoWriter(fname, CV_FOURCC('W', 'M', 'V', '2'), 25, Size(640, 480), true);
        if(!m_videoFile->isOpened()){
            m_videoFile->open(fname, CV_FOURCC('W', 'M', 'V', '2'), 25, Size(640, 480), true);
        }

Then when I close it here:

    if(m_videoFile != NULL){
       m_videoFile->release();
       m_videoFile = NULL;\
    }

I am using openCV3.0 on Windows 32 bit and using MSVC2013 compiler.

imShow is displaying the video as I am expecting.

Thanks in advance, Bear