tags:

views:

1087

answers:

3

Hello. I have been trying to create an application using OpenCV and Visual Studio 2008, to capture images from a webcam, apply a filter to them, and then write them to an AVI file. Everything works, except creating the AVI file.

The problem is that it works on my computer, but it doesn't work on my colleague's computer. The reason for that (I think) is that he does not have the necessary video encoders for OpenCV to use.

The cvCreateVideoWriter function does not return NULL, but I end up with a 0kb file on the disk.

+3  A: 

Why not testing all codecs, in order to play save:

CV_FOURCC('P','I','M','1')    = MPEG-1 codec

CV_FOURCC('M','J','P','G')    = motion-jpeg codec (does not work well)

CV_FOURCC('M', 'P', '4', '2') = MPEG-4.2 codec

CV_FOURCC('D', 'I', 'V', '3') = MPEG-4.3 codec

CV_FOURCC('D', 'I', 'V', 'X') = MPEG-4 codec

CV_FOURCC('U', '2', '6', '3') = H263 codec

CV_FOURCC('I', '2', '6', '3') = H263I codec

CV_FOURCC('F', 'L', 'V', '1') = FLV1 codec

A codec code of -1 will open a codec selection window (in windows).

SuperPro
I have tried, and none of them work. Same thing: cvCreateVideoWriter does not return NULL, and I get a 0kb AVI file
Ove
A: 

The problem was that my colleague had an older version of OpenCV installed. If I used the new OpenCV it had an encoder and it did all the work.

Ove
Can you post the version that you upgraded to? Was is the newest release or beta 1.1c?
JustSmith
I ended up using OpenCV 1.0 because it would work.Now, they have released 2.0. I have yet to test it.
Ove
A: 

hai..I have same problem with you..I wrote some code to save AVI file from captured images by webcam(using cvCreateCameraCapture())..but the AVI file always end up with 0kb size.. But when I use this code to copy another existing AVI file (using cvCreateFileCapture()), it work just fine..anyone knows where is the problem??

uLZy