I rebased the 4.4 branch of jernejsk/FFmpeg on ffmpeg 4.4.3. You can find that at faithanalog/FFmpeg-v4l2. This lets you use hardware accelerated video decoding on anything that uses v4l2-requests (hantro, rkvdec, etc.). Tested on my Quartz64. You can also download a .patch file that applies cleanly to upstream 4.4.3: v4l2-4.4.3.patch. If you’re on gentoo, drop this in
/etc/portage/patches/media-video/ffmpeg-4.4.3/. Tested on my Quartz64 and nowhere else. You also need to build with
--enable-v4l2-request --enable-libudev. On gentoo, use
EXTRA_FFMPEG_CONF='--enable-v4l2-request --enable-libudev' emerge ffmpeg and consider putting this in /etc/portage/env so you don’t forget later.
I had to drop hevc support because the original code was written against an unstable version of the hevc v4l2-requests API, and the API that ended up in mainline is slightly different. jernejsk/FFmpeg has a branch based on ffmpeg 5.x that has seen more recent work. There might be a working hevc implementation in there that could be backported. I haven’t tried. I probably won’t because I don’t really watch hevc content, and quartz64 only has hantro working right now, which can’t do hevc anyway. You should give that a look if you’re interested though.
You should use this with mpv’s new dmabuf-wayland backend for buttery smooth video playback under wayland. It eliminates a lot of the memory copies that were in the pipeline previously.
mpv --hwdec=drm --vo=dmabuf-wayland <whatever>
Unfortunately the on-screen display doesn’t work with this video output yet. No visual controls, no captions. It’s still experimental.
Make sure you’re in the
video group so you can access the right devices. Also make sure you’re using an up to date dtb. I used the dtb in linux 6.1.9 and it worked for me.