I am on ubuntu 22.04.
I installed ffmpeg with apt.
I am creating a video from some image files using python/opencv2 (installed via pip)
When I use:
cv2.VideoWriter_fourcc(*"mp4v")
the video is successfully created, but is not supported by firefox.
I read online that the H264 encoder would be a better fit for web-browsers supports.
ffmpeg -codecs | grep h264
shows:
DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_qsv h264_cuvid ) (encoders: libx264 libx264rgb h264_nvenc h264_omx h264_qsv h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )
but
cv2.VideoWriter_fourcc(*"h264")
results in:
OpenCV: FFMPEG: tag 0x34363268/'h264' is not supported with codec id 27 and format 'mp4 / MP4 (MPEG-4 Part 14)'
I could not find online what was wrong (h264 is not installed, how to install it? the 'fourcc' of h264 is not 'h264' ? I should not create a *.mp4 file ?)