VA-API with Chromium 97
Enabling VA-API Hardware Video Acceleration in Chromium 97
Enabling hardware video acceleration in browsers in 2022 is still a huge PITA. The fact that the steps you have to perform are constantly changing isn’t helping. So today, I sat down again trying to figure out what’s needed to get it to work with the latest version of AlienBOB’s chromium package.
Hardware video acceleration isn’t enabled yet by default and can’t be simply enabled by ticking boxes in the UI (at least, I didn’t find any). Instead, we need to pass some cli arguments to chromium. Since that would need to happen on every start, we have to make that permanent somehow.
AlienBOB’s chromium package ships with a configuration file in /etc/chromium/00-default.conf
. You can directly
adapt that configuration file to look like this:
# Default settings for chromium.
# This file is sourced by /usr/bin/chromium
# Options to pass to chromium:
CHROMIUM_FLAGS="--enable-features=VaapiVideoDecoder,VaapiVideoEncoder --use-gl=desktop"
This tells chromium to enable hardware accelerated video decoding and encoding. You can verify this by
restarting chromium and then visiting chrome://gpu
. It should show something similar to this:
Unfortunately, not all codecs are supported yet. Even though my hardware would support accelerated decoding for VP8, VP9 and AV1, chromium seems to only enable it for H264.
To see whether chromium really uses hardware acceleration for the video decoding, you can start playing
a video in the browser (recommended to be of a resolution above 720p). Show the developer tools (Ctrl+Shift+I
)
and go to the media tab. If you don’t have that enabled yet, you can find it in the hamburger menu at the right top
of the developer tools, under More tools
. In there you can select the video you are playing and it will show you
which decoder it uses.
If it says VDAVideoDecoder
there, then you’re successfully using VA-API in chromium. If you’re on Intel graphics, you
can perform a second verification step by running intel_gpu_top
in a terminal. If you see usage under Video
it works.