[FFmpeg-user] h264_v4l2m2m not working properly

Adam Nielsen a.nielsen at shikadi.net
Thu Jun 9 11:52:23 EEST 2022

> I am trying to use h264_v4l2m2m on a Raspberry pi 4B to do M2TS to H264
> hardware encoding, but it is not working properly. The log is below.
> http://0x0.st/oMOa.txt
> If I don't use hardware encoding or if the source is not m2ts (tested with
> mpeg-1 to h264(v4l2m2m)) I can encode.

It looks a bit surprising, it seems it's bailing because the audio is
corrupted.  What happens if you add -an to try the hardware encode but
without any audio?  I don't see why the audio would affect hardware vs
software video encoding though.

Maybe you could post an equivalent log showing the software H264 encode
so we can compare which messages are the same and which are different?

Do you get any errors in dmesg from the Pi H264 hardware encoder?
Sometimes it can fail if there isn't enough GPU memory, so you could
also try increasing gpu_mem in /boot/config.txt to see if it has any
effect.  It should work with 128 and definitely with 256.


More information about the ffmpeg-user mailing list