Ffmeg warning/error message

I use Jupyterlab to run OpenCV. From time to time, I get the following warning/error message. Can someone please advise how to handle it?

OpenCV: FFMPEG: tag 0x6765706d/‘mpeg’ is not supported with codec id 2 and format ‘mp4 / MP4 (MPEG-4 Part 14)’
OpenCV: FFMPEG: fallback to use tag 0x7634706d/‘mp4v’

what exactly did you do?

I think it is from cv2.VideoWriter or cv2.VideoWriter_fourcc. The error message is from the following lines:

sz = (int(camera.get(cv2.CAP_PROP_FRAME_WIDTH)),
fourcc = cv2.VideoWriter_fourcc(*‘mpeg’)
vout = cv2.VideoWriter()
vout.open(os.path.join(“videos”, “res”, video), fourcc, 20, sz, True)

that is not a valid fourcc. MPEG is a whole family of codecs and container formats and a lot beyond that.

what specific video format do you want to have?

The video is in H.264 format and from a security camera.

then you need to use the fourcc "avc1". ffmpeg will accept that.

more on that: what is the codec for mp4 videos in python OpenCV - Stack Overflow

1 Like

Thank you very much. It works with “avc1”. I also reviewed the link to Stack Overflow. Very useful info!