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 beta or 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:
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 (
The patches used by the Chromium Ubuntu builds with VA-API enabled used in this article are available here.
It should be clear to everyone reading this that Chromium Beta or 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. Using the PPAs below will overwrite your current stable Chromium installation (if already installed).
What's more, the Chromium Beta and Dev Branch PPA repositories used in this article requires performing 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 and I'll link it so you can manually download it in case you want to use the Beta PPA.
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 with VA-API support.
Chromium with VA-API support is available in two PPA repositories - one which has Chromium Beta and another one with Chromium Dev. Choose one from the 2 (and only add one)! The Beta PPA should be more stable.
Update: there is currently an issue with the Chromium packages from the Dev branch PPA. Hardware acceleration seems broken in the latest PPA builds. Until this is fixed, use the Beta branch PPA, which continues to provide Chromium browser builds with hardware acceleration enabled. Update 2: The Dev PPA was fixed - hardware acceleration works again with the builds from the Saiarcot895 Chromium Dev PPA.
To add the Chromium Beta branch PPA and install Chromium browser in Ubuntu, Linux Mint, and Ubuntu or Linux Mint flavors like Xubuntu, Kubuntu, Ubuntu MATE, Lubuntu, Linux Mint MATE, et.c, using:
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:
2. Install the VA-API driver
For Intel graphics cards, you'll need to install the
For Nvidia graphics cards you need the patched
For those using Ubuntu 19.04 (for which this package was not yet uploaded to the PPA), you can download the patched
3. Enable the Hardware-accelerated video option in Chromium.
Copy and paste the following in the Chrome URL bar:
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
Open a video on YouTube. Next, open a new tab in Chromium and enter the following in the URL bar:
On the
If it says
If it's not working, you could try to debug it by running
If you want to completely remove the Chromium with VA-API builds from your system, and revert to the official stable Chromium browser builds provided by Ubuntu / Linux Mint, you can purge the PPA.
To purge a PPA you'll need the PPA purge utility, which can be installed using:
And then purge the Chromium PPA you have added:
This article explains how to install a Chromium beta or 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:
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 Beta or 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. Using the PPAs below will overwrite your current stable Chromium installation (if already installed).
What's more, the Chromium Beta and Dev Branch PPA repositories used in this article requires performing 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 and I'll link it so you can manually download it in case you want to use the Beta PPA.
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 with VA-API support.
Chromium with VA-API support is available in two PPA repositories - one which has Chromium Beta and another one with Chromium Dev. Choose one from the 2 (and only add one)! The Beta PPA should be more stable.
To add the Chromium Beta branch PPA and install Chromium browser in Ubuntu, Linux Mint, and Ubuntu or Linux Mint flavors like Xubuntu, Kubuntu, Ubuntu MATE, Lubuntu, Linux Mint MATE, et.c, using:
sudo add-apt-repository ppa:saiarcot895/chromium-beta
sudo apt-get update
sudo apt install chromium-browser
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 you need the patched
vdpau-va-driver
from the Chromium Dev PPA. If you've added the Chromium Dev PPA, you can install it using this command:sudo apt install vdpau-va-driver
For those using Ubuntu 19.04 (for which this package was not yet uploaded to the PPA), you can download the patched
vdpau-va-driver
DEB package from here, and install it manually. You only need vdpau-video package (you don't need the -dbgsym
package) from Ubuntu 18.10 and install that.3. Enable the Hardware-accelerated video option in Chromium.
Copy and paste the following in the Chrome URL bar:
chrome://flags/#enable-accelerated-video-decode
(or search for the Hardware-accelerated video decode
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 MojoVideoDecoder (previously it was GpuVideoDecoder
, but now the Chromium builds use MojoVideoDecoder on Linux) it means that the video that's currently playing on YouTube in the other tab is using hardware-accelerated video decoding.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. How to remove Chromium with VA-API patches and use the official stable Ubuntu / Linux Mint Chromium builds
If you want to completely remove the Chromium with VA-API builds from your system, and revert to the official stable Chromium browser builds provided by Ubuntu / Linux Mint, you can purge the PPA.
To purge a PPA you'll need the PPA purge utility, which can be installed using:
sudo apt install ppa-purge
And then purge the Chromium PPA you have added:
- Chromium Beta PPA:
sudo ppa-purge ppa:saiarcot895/chromium-beta
- Chromium Dev PPA:
sudo ppa-purge ppa:saiarcot895/chromium-dev