Fedora Updates Chromium With VAAPI Support, Here's How To Enable Hardware-Accelerated Video Decoding

Chromium was updated in Fedora with a patch that enables VAAPI (Video Acceleration API) support. When VAAPI is used, the video playback should be smoother, while also using less CPU and improving the power usage.

While this patch was rejected by the upstream Chromium maintainers, there are quite a few third party packages that include the VAAPI patch, for Ubuntu, Arch Linux, and others. And now, Fedora includes this by default!

Why is this so important? For example, my laptop (using Chromium on Fedora 29) had a huge CPU usage when playing YouTube videos, causing it to get very hot while also draining the battery:

Chromium CPU Usage Fedora

This is the same video / Fedora laptop, but this time using Chromium with hardware-accelerated video decoding (VAAPI) enabled, showing a much lower CPU usage:

CPU Usage Chromium VAAPI Fedora

Another screenshot showing the differences in CPU usage while playing a video using Firefox, Chromium without the VAAPI patch, and Chromium with VAAPI, from fedoramagazine.org (Credits: Tobias Wolfshappen):


For AMD graphics, Chromium should use hardware-accelerated video decoding by default, but that's not the case for Intel graphics, which requires the libva-intel-driver package from RPM Fusion. As for Nvidia, I'm not sure because my Fedora laptop uses Intel graphics; but you most probably need a patched vdpau-va-driver to get it to work, like it is the case with Ubuntu.

For both Intel and AMD graphics though, if you want to enable hardware-accelerated video decoding for h264 videos, you'll need to install a couple of additional things. That's because the Fedora Chromium build doesn't support h264 by default.

Some older GPUs don't support hardware decoding for VP8/VP9 codecs. There's nothing that can be done about this - in such cases, VP8/VP9 videos won't be hardware accelerated.

One website that uses VP8/VP9 by default is YouTube. However, YouTube can be forced to use h264 instead of VP8/VP9, and thus get hardware-accelerated video decoding.

Related: How To Enable Hardware Acceleration In Chromium On Ubuntu Or Linux Mint (VA-API Patched PPA Builds)

The instructions below explain how to enable hardware-accelerated video decoding on Fedora with Intel graphics, as well as enabling it for h264 videos, for both Intel and AMD graphics, and forcing YouTube to use h264 instead of VP8/VP9. You'll also find instructions for how to check if Chromium is using hardware-accelerated video decoding.

Prerequisites:

  • The VAAPI patch was added starting with Chromium 71 in Fedora, so you need this version or newer (available in Fedora Rawhide and Fedora 29, in testing for Fedora 28 and EPEL 7)
  • You need (?) to use the Xorg session to get VAAPI to work with Chromium browser (for GDM / GNOME users, click on the gear icon next to the Sign In button from the login screen and select GNOME on Xorg). My laptop running Intel graphics couldn't make use of VAAPI under Wayland (XWayland) in Fedora 29, but I'm not entirely sure if this is also the case for AMD graphics.

I. AMD / Intel graphics: Enable RPM Fusion and install chromium-libs-media-freeworld for h264 support.

See these instructions for installing the RPM Fusion repository (either download and install the package for your Fedora version or following the command line instructions). Once RPM Fusion is enabled, install the chromium-libs-media-freeworld package on your Fedora system:

sudo dnf install chromium-libs-media-freeworld

II. AMD / Intel graphics: Force YouTube to use h.264 instead of VP8/VP9.

Install the h264ify Chrome extension to force YouTube to stream h.264 videos instead of VP8/VP9 videos.

That's because, like I mentioned above, many GPUs don't support hardware decoding for VP8/VP9 codecs, and these are used by default on YouTube.

III. Intel graphics only: Install the libva-intel-hybrid-driver and libva-intel-driver packages from RPM Fusion to get Chromium to make use of VAAPI.

sudo dnf install libva-intel-driver libva-intel-hybrid-driver

As a side note, the Hardware-accelerated video decode and Hardware-accelerated mjpeg decode for captured frame flags are enabled by default in the Fedora Chromium builds, so you don't need to enable these manually.

How to check if Chromium is using GPU video decoding


Fedora Chromium GPUVideoDecoder

To check if Chromium is using GPU video decoding, start by playing a video on YouTube. Next, open a new tab in Chromium and enter the following in the URL bar: chrome://media-internals

On the chrome://media-internals tab, click on the video url (in order to expand it), scroll down and look under Player Properties, and you should find the video_decoder property. If the video_decoder value is GpuVideoDecoder, it means that the video that's currently playing on YouTube in the other tab is using hardware-accelerated video decoding. You should also notice a much lower CPU usage in Chromium when playing videos.

If it says FFmpegVideoDecoder or VpxVideoDecoder, accelerated video decoding is not working, or maybe you forgot to install (or disabled) the h264ify Chrome extension or the chromium-libs-media-freeworld package from RPM Fusion.