Ask Your Question
-1

OpenCV VideoWriter on Mac

asked 2014-03-26 17:08:20 -0500

wales321 gravatar image

I have the following code which writes a few frames to a .avi video file. This works perfectly fine on a windows machine but when I try it on my Mac it creates the .avi file and displays no errors, but the file will not play. I haven't been able to find a clear solution so far. I am currently using Mac OSX 10.9.2.

void videoWriter()
{
    CvVideoWriter *writer;
    writer = cvCreateVideoWriter("test.avi",CV_FOURCC('I','Y','U','V'),1,Size(640,480),1);

    for(int i = 0; i < 9; i++)
    {
        if(imMan.returnSelect(i)) {
            cout << "Frame " << i << endl;
            /****** Original Image *********/
            Mat frame = imMan.returnOrg(i);
            IplImage fr = frame;
            cvWriteFrame(writer,&fr);
        }
    }

    cvReleaseVideoWriter(&writer);
}
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-09-23 14:10:49 -0500

CV gravatar image

try to use MOV extension... CV_FOURCC('m','p','4','v').

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-03-26 17:08:20 -0500

Seen: 605 times

Last updated: Mar 26 '14