I am trying to save a video file with openCV under Mandriva Linux 2009.1. Unfortunately cvCreateVideoWriter always returns null although I could see and modify both and mpeg fiels, in other words cvCaptureFromCam, cvCaptureFromAvi, cvRetrieveFrame is working.
I tried all the possible codecs from this tutorial and this codec page. I also tried 0 for uncompressed avi and -1 for a selection box in the fourcc parameter, but no choice has popped up and nothing happened. I also modified isColor to 0.
I also have write permissions in the working directory.
Here is the relevant code snippet:
CvVideoWriter *writer = 0;
int isColor = 1;
int fps = 25;
int frameW = 640;
int frameH = 480;
if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0])))
capture = cvCaptureFromCAM( argc == 2 ? argv[1][0] - '0' : 0 );
else if( argc == 2 ) {
printf("argc == 2 :%s:\n", argv[1] );
capture = cvCaptureFromFile( argv[1] );
}
cvInitSystem(argc,argv);
writer = cvCreateVideoWriter("out.avi",CV_FOURCC('I','Y','U','V'),fps,cvSize(frameW,frameH),isColor);
What could be the problem?