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

You may have noticed that watching HD videos from Youtube and other similar websites in Google Chrome or Chromium browsers on Linux considerably increases your CPU usage and, if you use a laptop, it gets quite hot and the battery drains very quickly. That's because Chrome / Chromium (Firefox too but there's no way to force this) doesn't support hardware accelerated video decoding on Linux.

This article explains how to install a Chromium development build which includes a patch that enables VA-API on Linux, bringing support for GPU accelerated video decoding, which should significantly decrease the CPU usage when watching HD videos online. The instructions cover only Intel and Nvidia graphics cards, as I don't have an ATI/AMD graphics card to try this, nor do I have experience with such graphics cards.

This is Chromium from the Ubuntu (18.04) repositories without GPU accelerated video decoding playing a 1080p YouTube video:

Chromium browser no hardware acceleration

The same 1080p YouTube video playing in Chromium with the VA-API patch and hardware accelerated video decode enabled on Ubuntu 18.04:

Notice the CPU usage in the screenshots. Both screenshots were taken on my old, but still quite powerful desktop. On my laptop, the Chromium CPU usage without hardware acceleration goes way higher.

The patch to add VA-API support to Chromium on Linux, titled "Enable VAVDA, VAVEA and VAJDA on linux with VAAPI only" was was initially submitted to Chromium more than a year ago, but it has yet to be merged.

Chrome has an option to override the software rendering list (#ignore-gpu-blacklist), but this option does not enable hardware accelerated video decoding. After enabling this option, you may find the following when visiting chrome://gpu: "Video Decode: Hardware accelerated", but this does not mean it actually works. Open a HD video on YouTube and check the CPU usage in a tool such as htop (this is what I'm using in the screenshots above to check the CPU usage) - you should see high CPU usage because GPU video decoding is not actually enabled. There's also a section below for how to check if you're actually using hardware accelerated video decoding.

The patches used by the Chromium Ubuntu builds with VA-API enabled used in this article are available here.

Installing and using Chromium browser with VA-API support on Ubuntu or Linux Mint

It should be clear to everyone reading this that Chromium Dev Branch is not considered stable. So you might find bugs, it may crash, etc. It works fine right now but who knows what may happen after some update.

What's more, the Chromium Dev Branch PPA requires you to perform some extra steps if you want to enable Widevine support (so you can play Netflix videos and paid YouTube videos, etc.), or if you need features like Sync (which needs registering an API key and setting it up on your system). Instructions for performing these tweaks are explained in the Chromium Dev Branch PPA description.

For Nvidia graphics, the vdpau video driver needs to be updated in order to implement vaQuerySurfaceAttributes. So a patched vdpau-va-driver is required to use this with Nvidia. Thankfully, the Chromium-dev PPA provides this patched package.

Chromium with the VA-API patch is also available for some other Linux distributions, in third-party repositories, like Arch Linux (for Nvidia you'll need this patched libva-vdpau-driver) for example. If you don't use Ubuntu or Linux Mint, you'll have to find these packages yourself.

1. Install Chromium Dev Branch with VA-API support.

There's a Chromium Beta PPA with the VA-API patch, but it lacks vdpau-video for Ubuntu 18.04. If you want, you can use the Beta PPA instead of the Dev PPA which I'll be using in these instructions, but if you have an Nvidia graphics card, you'll need to download vdpau-va-driver from the Dev PPA, install it, and make sure Ubuntu / Linux Mint doesn't update this package (so this complicates things a bit; there's no need to do this manually if you plan on using the Dev PPA the instructions below).

You can add the Chromium Dev branch PPA and install the latest Chromium browser development build in either Ubuntu or Linux Mint (and other Ubuntu-based Linux distributions, including elementary, as well as Ubuntu or Linux Mint flavors like Xubuntu, Kubuntu, Ubuntu MATE, Linux Mint MATE and so on) using:

sudo add-apt-repository ppa:saiarcot895/chromium-dev
sudo apt-get update
sudo apt install chromium-browser

2. Install the VA-API driver

For Intel graphics cards, you'll need to install the i965-va-driver package (it may already be installed):

sudo apt install i965-va-driver

For Nvidia graphics cards (it should work with both the open source Nouveau drivers and the proprietary Nvidia drivers), install vdpau-va-driver:

sudo apt install vdpau-va-driver

Update for Ubuntu 18.10: You need the patched vdpau-va-driver package from the same saiarcot895/chromium-dev PPA. There is currently no vdpau-va-driver in the PPA for Ubuntu 18.10, but the Ubuntu 18.04 package can be installed and works in Ubuntu 18.10. You can download it from here (download the Ubuntu 18.04 version of the package for your architecture - it should have "18.04" in the package name).

To prevent this package from updating in Ubuntu 18.10 (which would break hardware acceleration in Chromium), use this command after installing it:

sudo apt-mark hold vdpau-va-driver

More about preventing packages from updating in Ubuntu / Linux Mint / Debian.

3. Enable the Hardware-accelerated video option in Chromium.

Copy and paste the following in the Chrome URL bar: chrome://flags/#enable-accelerated-video (or search for the Hardware-accelerated video option in chrome://flags) and enable it, then restart Chromium browser.

On a default Google Chrome / Chromium build, this option shows as unavailable, but you'll be able to enable it now because we've used the VA-API enabled Chromium build.

4. Install h264ify Chrome extension.

YouTube (and probably some other websites as well) uses VP8 or VP9 video codecs by default, and many GPUs don't support hardware decoding for this codec. The h264ify extension will force YouTube to use H.264, which should be supported by most GPUs, instead of VP8/VP9.

This extension can also block 60fps videos, useful on lower end machines.

You can check the codec used by a YouTube video by right clicking on the video and selecting Stats for nerds. With the h264ify extension enabled, you should see avc / mp4a as the codecs. Without this extension, the codec should be something like vp09 / opus.

How to check if Chromium is using GPU video decoding

Open 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.

Chromium GpuVideoDecoder Linux

If it says FFmpegVideoDecoder or VpxVideoDecoder, accelerated video decoding is not working, or maybe you forgot to install or disabled the h264ify Chrome extension.

If it's not working, you could try to debug it by running chromium-browser from the command line and see if it shows any VA-API related errors. You can also run vainfo (install it in Ubuntu or Linux Mint: sudo apt install vainfo) and vdpauinfo (for Nvidia; install it in Ubuntu or Linux Mint: sudo apt install vdpauinfo) and see if it shows an error.


  1. Thanks, quite an interesting article :)

  2. nice articles, works for me
    for those who are using intel 8th gen CPU, you can hardware accelerate videos up to 4k60fps without using the h264ify extension

  3. Thanks for a great article. I want to point out that all of this is pretty much setup for you in Fedora 29. All you need is install chromium-vaapi package and Voilla!


Powered by Blogger.