Pergunta

I have been working on capturing from IP Camera and saving the stream as a video. Now the code is simple, I have made a video writer and am saving the video. I am using the standard avi container for the video.

When we define the video writer we also have to define the codec that we are supposed to use while saving the video. Now the document here specifies the list of codecs as follows:

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

But on using them the video file that was being made was not proper. Its size was 0. So on checking further I found that the codecs must be installed on the system and the opencv version must also be compatible with the codecs. Also, the codecs that can be applied depends on the OS that one is using.

My OS is Windows 7 and OpenCV version is 2.4.6.

The question: Is there a document or a webpage that specifies the codecs that can be used with each version of OpenCV and also specifies the OS details? If it does exist then where can I find it?

Foi útil?

Solução

This page explains it works:

Moreover, If you pass for the argument minus one, a window will pop up at runtime that contains all the codec installed on your system and ask you to select the one to use:

outputVideo.open(NAME, -1, inputVideo.get(CAP_PROP_FPS), S, true);

enter image description here

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top