- Raspberry Pi 4, 4 GB
- Rapsberry Pi OS Lite, 64 bit (2022-09-22)
- Kernel 5.15.61-v8+
- ffmpeg 4.3.4-0+deb11u1+rpt3
config.txt
has the following relevant entry:
# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
According to my research, it would seem that the RPI4 is capable of hardware-accelerated video encoding using ffmpeg (from v4.3 on) via the h264_v4lm2m2
codec. ffmpeg -codecs
and ffmpeg -encoders
shows this codec to be available. Other people with a similar setup have gotten this to work successfully.
When I try this:
ffmpeg -i big_buck_bunny_720p_10mb.mp4 -c:v h264_v4l2m2m -c:a copy out.mp4
It gives me two warnings (see last two lines), but proceeds to encode the file anyway:
[h264_v4l2m2m @ 0x557353b190] <<< v4l2_encode_init: fmt=0/-1
[h264_v4l2m2m @ 0x557353b190] Using device /dev/video11
[h264_v4l2m2m @ 0x557353b190] driver 'bcm2835-codec' on card 'bcm2835-codec-encode' in mplane mode
[h264_v4l2m2m @ 0x557353b190] requesting formats: output=YU12 capture=H264
[h264_v4l2m2m @ 0x557353b190] Failed to set number of B-frames: Invalid argument
[h264_v4l2m2m @ 0x557353b190] Failed to set gop size: Invalid argument
Hardware acceleration seems to work, as it encodes at ~130 fps. However, the resulting file is corrupted and can't be played.
What am I missing?