11

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

I used the following fourcc in opencv, but I am getting error that suitable codec is not installed.

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

When I run my application I get the following error message:

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

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

Michael
  • 57,169
  • 9
  • 80
  • 125
mans
  • 17,104
  • 45
  • 172
  • 321

1 Answers1

7

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

OpenCV can write videos using FFMPEG or VFW. You need to compile FFPMEG with x264-support (instructions can be found on FFMPEG's website)

If you are using VFW: Take a look at http://sourceforge.net/projects/x264vfw/

kamjagin
  • 3,614
  • 1
  • 22
  • 24
  • 2
    do you know the fourcc or id for the VFW x264 codec? If I use `fourcc=CV_FOURCC('X','2','6','4') ;` I get a warning in the terminal and a vfw log window which I would like to omit. But the video is successfully recorded... so I just want to remove the warning messages and windows, I guess I would achieve this by providing the right id or fourcc code... – Micka Oct 14 '16 at 09:16