This is my code for recording videos on Raspberry Pi 4 running Raspbian Buster:
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
writer = cv2.VideoWriter(tempVideo.path, fourcc, framerate, resolution, True)
writer.write(frame)
However, no matter what codec I try, I keep getting errors like:
OpenCV: FFMPEG: tag 0x47504a4d/'MJPG' is not supported with codec id 7 and format 'mp4 / MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
Setting fourcc = 1
also did not help. Here is what I see:
OpenCV: FFMPEG: tag 0xffffffff/'????' is not found (format 'mp4 / MP4 (MPEG-4 Part 14)'
Is there a way to list all the supported codecs and their tags?
Here is the link with all fourcc codecs.
http://www.fourcc.org/codecs.php
Some codecs don't exist there, but in your case, it is not an error it is just a fallback, so your code is running anyway and in the output you will get your mp4 file.
If you don't like how it looks just use this
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
or
fourcc = 0x00000021
User contributions licensed under CC BY-SA 3.0