Videowriter recording MP4 + X264 (OpenCV 3.1)

asked 2016-12-23 08:02:54 -0500

cedricverst gravatar image

I'm trying to record a video with the X264 codec and MP4 format. The resulting video recording works, and can be played with a videoplayer, however I receive following warning.

OpenCV: FFMPEG: tag 0x34363258/'X264' is not supported with codec id 28 and format 'mp4 / MP4 (MPEG-4 Part 14)' OpenCV: FFMPEG: fallback to use tag 0x00000021/'!???'

I've been looking in the OpenCV code and it looks that a fallback mechanism is used (and another tag is used instead). Can someone tell me why this is happening, and how I can remove the warning.

Thanks! Cédric

edit retag flag offensive close merge delete


which fourcc / format did you try ?

can you try with another format(container), like .avi ?

see here for the tag enum

berak gravatar imageberak ( 2016-12-23 09:06:27 -0500 )edit

I used this CV_FOURCC('X','2','6','4'). I've tried it with other containers (mkv and avi), and I can confirm that it works. However the reason I want to use MP4, is because if I use the containers (mkv or avi), it doesn't get displayed in the HTML5 video element (in Safari and Firefox); though Chrome can handle it.

Therefore I prefer to have the MP4 container, as this works in all browsers (Firefox, Safari, and Chrome).

cedricverst gravatar imagecedricverst ( 2016-12-23 09:12:13 -0500 )edit

sure, i see. so it used H263P instead of H264.

berak gravatar imageberak ( 2016-12-23 09:24:36 -0500 )edit

Should I just swap the FOURCC with H263 or is it something else? FYI I compiled FFMPEG with h264 support.

cedricverst gravatar imagecedricverst ( 2016-12-23 09:28:14 -0500 )edit

if I replace the fourcc by 0x00000021 the error goes away, but still not clear what this codec is?

cedricverst gravatar imagecedricverst ( 2016-12-23 10:39:05 -0500 )edit

Looks like someone used the same trick:

cedricverst gravatar imagecedricverst ( 2016-12-23 10:43:51 -0500 )edit