Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

VideoWriter fourcc=-1 works but CV_FOURCC('C','R','A','M') does not

Howdy,

I am using the VideoWriter class to capture video from a camera to a file. I am doing CV in the code as well, of course, but am adding video capture to help troubleshoot and optimize.

I am able to capture the video if I pass the magic number "-1" as the fourcc parameter, like so:

outputVideo = new cv::VideoWriter(outputVideo_name, -1, 20, img_rgb.size(), true);

I select "Microsoft Video 1" from the dropdown and it generates a video file using the CRAM codec.

However, if I replace that "-1" with "CV_FOURCC('C','R','A','M')", it says it's capturing video but the file is always 6kB and does not play. Using MSVC or WHAM produces similar results.

I am running on Windows 7 with a PS3 Eye camera using the CL-Eye driver and OpenCV 2.4.1, compiled with Eclipse and MinGW's g++ (GCC) 4.5.2.

Any ideas on what I might be doing wrong?

Thanks,

Nathan

VideoWriter fourcc=-1 works but CV_FOURCC('C','R','A','M') does not

Howdy,

I am using the VideoWriter class to capture video from a camera to a file. I am doing CV in the code as well, of course, but am adding video capture to help troubleshoot and optimize.

I am able to capture the video if I pass the magic number "-1" as the fourcc parameter, like so:

outputVideo = new cv::VideoWriter(outputVideo_name, -1, 20, img_rgb.size(), true);

I select "Microsoft Video 1" from the dropdown and it generates a video file using the CRAM codec.

However, if I replace that "-1" with "CV_FOURCC('C','R','A','M')", it says it's capturing video but the file is always 6kB and does not play. Using MSVC or WHAM produces similar results.

I am running on Windows 7 with a PS3 Eye camera using the CL-Eye driver and OpenCV 2.4.1, compiled with Eclipse and MinGW's g++ (GCC) 4.5.2.

Any ideas on what I might be doing wrong?

Thanks,

Nathan

=====

EDIT: Images showing binary differences between now-working and working generated video files:

image description

(Here there be zeros.)

image description