Video codec for H264 with opencv

I am trying to create a movie using opencv and I need this output file in H264 format.

I used the following 4cc in opencv, but I get an error that a suitable codec is not installed.

fourcc=CV_FOURCC('H','2','6','4') ; 

When starting my application, the following error message appears:

 Could not find encoder for codec id 28: Encoder not found 

What do I need to be able to use this codec in OpenCV?

+7
source share
1 answer

H264 is not a codec, but rather a standard, whereas, for example, x264 is an encoder that implements the H264 standard (CV_FOURCC ("X", "2", "6", "4");).

OpenCV can record video using FFMPEG or VFW. You need to compile FFPMEG with x264 support (instructions can be found on the FFMPEG website)

If you are using VFW: see http://sourceforge.net/projects/x264vfw/

+6
source

All Articles