Ask Your Question

Revision history [back]

writing MJPG file by VideoWriter in Visual Studio x64/Release platform

I am trying the following code in Windows 7 pro; Visual Studio 2012 Express with x64/Release configuration using the pre-built OpenCV 2.4.8 and 2.4.5 (x64/vc11). In my environment, EXPECT_EQ fails.

#include "opencv2/opencv.hpp"
void EXPECT_EQ(double a, double b) { if (a != b) { std::cout << "failed" << std::endl; } } 
int main()
    double current_time = 0.0;
    cv::Mat blank = cv::Mat::zeros(480, 640, CV_8UC3);
    cv::VideoWriter writer("output.avi", CV_FOURCC('M','J','P','G'),
                           50.0, blank.size(), true);
    current_time += 20.0;
    writer << blank;
    EXPECT_EQ(20.0, current_time);
    return 0;

This happens only when I write MJPG format files as far as I tried. The problem does not reproduce if I choose Win32 (x86) or Debug configurations.

Any help or comments are appreciated. Thank you very much in advance.