Google Chrome 88 (and newer) has made hardware accelerated video decoding available on Linux, but it’s not enabled by default. Google Chrome is not the only Chromium-based web browser to support hardware acceleration on Linux though. This article explains how to enable hardware-accelerated video decoding in Google Chrome, Brave, Vivaldi and Opera web browsers running on Debian, Ubuntu, Pop!_OS or Linux Mint (Xorg only).
Using hardware-accelerated video decode in your web browser should result in using less CPU usage (and thus, less battery draining) when playing online videos.
It’s worth noting that Chromium web browser had patches that allowed making hardware accelerated video decoding available on Linux for some time, and some Linux distributions packaged it using those patches. So Chromium users have had hardware acceleration on Linux for some time, depending on their Linux distribution or if they installed the patched Chromium in some other way. E.g. on Ubuntu / Linux Mint there’s a PPA with VA-API patched Chromium builds. Thus, these instructions may also work for Chromium browser, depending on how it’s built.
I’d also like to add that these instructions to enable hardware accelerated video decoding also work on other Linux distributions, and not just Debian / Ubuntu-based Linux distributions, however, the driver names are different.
I tested these instructions using Ubuntu 20.10 desktop with Nvidia graphics, and the web browsers listed below installed using their original Ubuntu packaging (using a DEB package). Also tested using a laptop with Intel graphics (10th gen) on Ubuntu 20.04 and 20.10.
In my test, I was able to get hardware-accelerated video decode to work on Linux using:
- Google Chrome stable 88
- Brave stable 1.19
- Vivaldi snapshot 3.6
- Opera Beta 74
Obviously, it should continue to work with versions newer than these (so Google Chrome 89, Brave 1.20, etc.).
For me, hardware-accelerated video decode didn’t work using:
- Vivaldi stable 3.5
- Opera stable 73
- Microsoft Edge – there’s no even a
chrome://flags/#enable-accelerated-video-decodeflag (to enable hardware-accelerated video decode).
Also, this doesn’t work on Wayland. You can use VA-API on XWayland, using the
--use-gl=egl command line flag, but I did not try it.
How to enable hardware-accelerated video decode in Google Chrome, Brave, Vivaldi And Opera web browsers on Debian, Ubuntu or Linux Mint
Things you need to enable hardware-accelerated video decode in the web browsers I mentioned above (so Google Chrome 88+, Brave 1.19+, Vivaldi 3.6+ and Opera 74+):
1. Enable the following web browser flags:
- Override software rendering list:
- Hardware-accelerated video decode:
2. Install the VA-API driver to be able to decode media (source):
- For Intel Gen 7 and earlier hardware:
sudo apt install i965-va-driver-shaders
- For Intel Gen 8+ hardware:
sudo apt install intel-media-va-driver-non-free
- For Nouveau and AMD drivers (I couldn’t get any browser to use hardware acceleration with the Nouveau drivers, maybe you have better luck):
sudo apt install mesa-va-drivers
- For proprietary Nvidia drivers – you can install them from the repositories or by using the Proprietary GPU Drivers PPA (e.g. launch the Additional Drivers dialog on Ubuntu and install it from there). If you’re using proprietary Nvidia drivers, you’ll also need a patched
vdpau-va-driver. You can get it from here for Ubuntu / Linux Mint. The Ubuntu 20.04 package from there also works on Ubuntu 20.10 and newer. If you want to see the patches used by this package, download the .debian.tar.gz archive (from the same link as above) and look inside the “patches” folder.
Why the non-free versions of the
i965-va-driver? In theory this should work with the free version (?), but in my test on a laptop with Intel Gen 10, hardware-accelerated video decoding only worked with the
intel-media-va-driver-non-free driver, and not
intel-media-va-driver (I’m not sure about the i965 driver, but I assumed it might be similar).
3. Only needed for graphics card that don’t support VP9 hardware video decoding: install the h264ify browser extension.
If your graphics card doesn’t support VP9 hardware video decoding, install the h264ify browser extension (or enhanced-h264ify – some users say this works for them while the original extension doesn’t; for me it’s the other way around) and make sure it’s enabled for VP9.
If you still don’t see MojoVideoDecoder in the
chrome://media-internals tab (see below in the section for how to check if hardware-accelerated video decoding is enabled and actually used by the browser), try to restart the web browser after installing this extension. I’ve seen cases where this was needed, and some in which it wasn’t required.
4. Launch the web browser using the
--use-gl=desktop flag to enable VA-API hardware acceleration.
To be able to use VA-API for video decoding you’ll need to launch the web browser, be it Chromium, Google Chrome, Brave, Opera or Vivaldi, using the following command line flag:
--use-gl=desktop. This makes the web browser use OpenGL and disable ANGLE as the rendering backend. While there are places where I’ve read this shouldn’t be needed anymore, this was required in my test, with both Nvidia and Intel graphics (I don’t have AMD graphics to test this).
E.g. to launch Google Chrome using this flag:
Launch Brave using this:
And so on.
To make this change permanent, copy the browser .desktop file from
~/.local/share/applications (if this folder doesn’t exist, create it). By copying the file here, we’re making sure it won’t be overwritten by an update. Then, open the .desktop file (e.g.
google-chrome.desktop, etc.) from this
~/.local/share/applications location, with a text editor. In this file, search for the line starting with
Exec=, and change the executable to include
--use-gl=desktop. E.g. for Brave:
Exec=/usr/bin/brave-browser-stable --use-gl=desktop, or for Google Chrome:
Exec=/usr/bin/google-chrome-stable --use-gl=desktop %U
Important note: If you see a completely white video image when launching the browser with
chrome://flags and make sure that Vulkan is not enabled there. Having Vulkan enabled and launching the browser using the
--use-gl=desktop option will cause this to happen.
Another note, this time for Opera users: if after using the h264ify extension, you can no longer play videos on YouTube and other such websites, see the solutions from here to enable h264 support in Opera (note that if the web browser you’re using is Opera Beta, the folder must be
How to check if hardware-accelerated video decoding is enabled and working in any Chromium-based web browser
Now let’s check and see if the web browser is using hardware-accelerated video decoding.
First let’s check if the browser supports hardware-accelerated video. Do this by opening a new tab and visiting
chrome://gpu. On this page you should see “Video Decode: Hardware accelerated” (in green, like here):
This means that your web browser now supports hardware-accelerated video decoding. But is it able to actually hardware decode video? Let’s check that too, by opening a YouTube video in one tab, leave that tab running and open a new tab with
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
kVideoDecoderName value is
MojoVideoDecoder (previously it was
GpuVideoDecoder, but now
MojoVideoDecoder is used on Linux) it means that the video that’s currently playing on YouTube in the other tab is using hardware-accelerated video decoding. All other kVideoDecoderName values (VpxVideoDecoder, FFmpegVideoDecoder and Dav1dVideoDecoder) mean that the video playing in the other browser tab is using software rendering.