[BUG] H.265 Hardware Acceleration Fails on Raspberry Pi 5 Host OS, Preventing Smooth Playback in Anthias
Description
On a fresh installation of Anthias on a Raspberry Pi 5, H.265 (HEVC) video playback is extremely choppy and unusable. Further investigation reveals that this is not an issue with Anthias itself, but a failure of the underlying Raspberry Pi OS to enable hardware-accelerated video decoding. The ffplay process (both inside and outside of Docker) is forced to use inefficient software decoding, resulting in extremely high CPU usage. Steps to Reproduce
-
Install a fresh copy of Raspberry Pi OS Lite (64-bit, Bookworm) on a Raspberry Pi 5 and run a full system update (
sudo apt update && sudo apt full-upgrade -y). -
Install ffmpeg on the host OS (
sudo apt install ffmpeg -y). -
Add the pi user to the render group (
sudo usermod -a -G render pi). -
Ensure the correct video driver is enabled in /boot/firmware/config.txt (
dtoverlay=vc4-kms-v3d,cma-512). -
After a reboot, attempt to play an H.265 video file directly on the host OS using the hardware decoder command:
ffplay -vcodec hevc_v4l2m2m -i /path/to/video.mp4 -
Observe that the video is extremely choppy or fails to play, with ffplay consuming >200% CPU.
-
Proceed with the manual Anthias installation. The choppy playback issue will be present in the Anthias viewer as well.
Expected Behavior
Hardware-accelerated playback should function correctly on the host Raspberry Pi OS. The ffplay -vcodec hevc_v4l2m2m command should result in smooth video playback with low CPU usage. Consequently, Anthias should be able to leverage this functionality for smooth playback within its viewer.
Screenshots
The following diagnostic output from top was captured while attempting to play the H.265 video, clearly showing the CPU overload from software decoding:
top - 21:47:06 up 13 min, 2 users, load average: 2.12, 1.79, 1.08
Tasks: 221 total, 1 running, 220 sleeping, 0 stopped, 0 zombie
%Cpu(s): 80.0 us, 20.0 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 16211.2 total, 13822.2 free, 1256.0 used, 1266.5 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 14955.2 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3607 pi 20 0 1883360 218720 101936 S 300.0 1.3 2:23.00 ffplay
Environment
Device: Raspberry Pi 5
OS: Raspberry Pi OS (64-bit, Bookworm), fully updated as of 2025-08-18.
Anthias Version: Latest version installed via the official script.
Installation Method: Manual Installation on top of Raspberry Pi OS.
Additional Context
The core issue appears to be that the ffmpeg package provided by Raspberry Pi OS is not correctly interfacing with the V4L2 hardware decoder for HEVC on the Pi 5, even when all user permissions and boot configurations are correct. This is a system-level issue that prevents Anthias from functioning as expected.
@sabure14, just to add some context:
- I tried installing VLC on my Raspberry PI 5 running Bookworm directly on the host, not inside the Docker container. The playback was smooth.
- Running VLC inside the
anthias-viewercontainer won't work.
Also asked on the Pi forums - https://forums.raspberrypi.com/viewtopic.php?p=2332729
-vcodec hevc_v4l2m2m is the V4L2 Stateful Decoder API implementation within FFmpeg.
The Pi implements the V4L2 Stateless Decoder API for HEVC decode.
The version of FFmpeg in Raspberry Pi OS supports this through an FFmpeg hwaccel module.
@nicomiguelino The H.265 video playback is smooth using VLC after a clean install of Raspberry Pi OS. However, playback of the same video file is not smooth at all using Anthias. It seems that Anthias does not have access to HEVC the way VLC does.
@sabure14, I'll take that into consideration. Thanks. If it's really not possible to play videos smoothly via ffplay, switching to a different player (like VLC) that supports hardware decoding (even when running in a Docker container) could be an option.