How to enable hardware accelerated video decoding in Google Chrome, Brave, Vivaldi and Opera browsers on Debian, Ubuntu or Linux Mint

Google Chrome 88 (and higher) already provides hardware accelerated video decoding on Linux, but it is not enabled by default. Although the Chrome browser is not the only Chromium-based web browser, it supports hardware acceleration on Linux. This article describes how to run on Debian, Ubuntu, Pop! Enable hardware-accelerated video decoding in Google Chrome, Brave, Vivaldi and Opera web browsers running on _OS or Linux Mint (Xorg only).

Using hardware-accelerated video decoding functions in a web browser can reduce CPU usage (thus reducing battery consumption) when playing online videos.

It is worth noting that the Chromium web browser has patches that allow hardware accelerated video decoding on Linux for a period of time, and some Linux distributions package it with these patches. Therefore, Chromium users have been hardware acceleration on Linux for some time, depending on their Linux distribution or whether they have installed patched Chromium in some other way. For example, on Ubuntu/Linux Mint, there is a PPA built by Chromium with VA-API patching. Therefore, depending on how the Chromium browser is built, these instructions may also apply to the Chromium browser.

I should also add that these instructions to enable hardware accelerated video decoding can also be used on other Linux distributions, not only on Debian/Ubuntu-based Linux distributions, but the driver names are also different.

I tested these instructions using an Ubuntu 20.10 desktop with Nvidia graphics and installed the web browsers listed below using its original Ubuntu packaging (using the DEB package). It has also been tested on Ubuntu 20.04 and 20.10 using laptops with Intel graphics (10th generation).

In my test, I was able to use the following methods to make hardware accelerated video decoding run on Linux:

  • Google Chrome stable version 88
  • Brave and stable 1.19
  • Vivaldi snapshot 3.6
  • Opera Beta 74

Obviously, it should be able to continue to use newer versions than these (such as Google Chrome 89, Brave 1.20, etc.).

For me, hardware accelerated video decoding is not possible with the following command:

  • Vivaldi stable version 3.5
  • Opera stable 73
  • Microsoft Edge-not even chrome://flags/#enable-accelerated-video-decode Flag (to enable hardware accelerated video decoding).

In addition, this does not work on Wayland.You can use VA-API on XWayland, use --use-gl=egl Command line flag, but I did not try.

You need to enable hardware accelerated video decoding in the web browsers mentioned above (for example, Google Chrome 88+, Brave 1.19+, Vivaldi 3.6+ and Opera 74+):

1. Enable the following web browser flags:

  • Overlay software rendering list: chrome://flags/#ignore-gpu-blocklist
  • Hardware accelerated video decoding: chrome://flags/#enable-accelerated-video-decode

2. Install the VA-API driver to be able to decode the media (Resources):

  • 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 cannot use any browser to use hardware acceleration in the Nouveau driver, maybe you have better luck):

sudo apt install mesa-va-drivers
  • For proprietary Nvidia drivers-you can install them from the repository or use Proprietary GPU driver PPA (For example, launch the “Additional Drivers” dialog on Ubuntu and install it from there).If you use the proprietary Nvidia driver, you also need to patch vdpau-va-driver.You can get it from here Suitable for Debian / Ubuntu / Linux Mint / Pop! _OS etc. The Ubuntu 20.04 package there is also available on Ubuntu 20.10 and higher. If you want to check the patches used by this package, please download the .debian.tar.gz archive file (from the same link as above) and check it in the “patches” folder.If this DEB does not work on Debian (I haven’t tried it), please use Same link Download the .orig.tar.gz and .debian.tar.xz archives and build the DEB package on the system.

Why use the non-free version intel-media-va-driver with i965-va-driver?In theory, it should work with the free version (?), but in my tests on laptops with Intel Gen 10, hardware accelerated video decoding only works for intel-media-va-driver-non-free Driver instead of intel-media-va-driver (I’m not sure about the i965 driver, but I think it might be similar).

3. Only for graphics cards that do not support VP9 hardware video decoding: install the h264ify browser extension.

If your graphics card does not support VP9 hardware video decoding, please install h264ify Browser extension (or Enhanced h264ify -Some users say that this works for them, and the original extension is not valid; for me it is another way) and make sure that it is enabled for VP9.

If you still can’t see MojoVideoDecoder, chrome://media-internals Tag (please refer to the following in this section to learn how to check whether hardware-accelerated video decoding is enabled and actually used by the browser), please try to restart your web browser after installing this extension. I have seen some situations where this is required, and some do not.

4. Use --use-gl=desktop Flag to enable VA-API hardware acceleration.

In order to be able to use VA-API for video decoding, you need to start a web browser with the following command line flags, including Chromium, Google Chrome, Brave, Opera or Vivaldi. --use-gl=desktop. This makes the web browser use OpenGL and disable ANGLE as the rendering backend. Although there are some places where I no longer need to read this article, in my tests, both Nvidia and Intel graphics cards are required (I don’t have an AMD graphics card to test this).

For example, start Google Chrome with the following flag:

google-chrome-stable --use-gl=desktop

Start Brave with the following command:

brave-browser --use-gl=desktop

and many more.

To keep this change permanently, copy the browser .desktop file from the following location: /usr/share/applications to ~/.local/share/applications (If this folder does not exist, please create it). By copying the file here, we ensure that the file will not be overwritten by the update.Then, open the .desktop file (for example brave-browser.desktop, brave-browser-beta.desktop, google-chrome.desktopEtc.) from here ~/.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. For example, brave: Exec=/usr/bin/brave-browser-stable --use-gl=desktop, Or for Google Chrome browser: Exec=/usr/bin/google-chrome-stable --use-gl=desktop %U

Important note: If you see a complete white video image when you start the browser with the following command --use-gl=desktop,an examination chrome://flags And make sure that Vulkan is not enabled here.Enable Vulkan and launch the browser with the following command --use-gl=desktop Options will cause this to happen.

Remind you again, this time it is an Opera user: If you can no longer play videos on YouTube and other such sites after using the h264ify extension, please see Solve from here To enable h264 support in Opera (please note that if your web browser is Opera Beta, the folder must be /opera-beta).

That’s it.

How to check if hardware accelerated video decoding is enabled and working in any Chromium-based web browser

Now, let’s check if the web browser is using hardware accelerated video decoding.

First, let’s check if the browser supports hardware accelerated video.To do this, open a new tab and visit chrome://gpu. On this page, you should see “Video Decoding: Hardware Acceleration” (green, like here):

Chrome video decoding hardware accelerates Linux

This means that your web browser now supports hardware accelerated video decoding. But can it actually perform hardware decoding on video?Let’s check that by opening a YouTube video in a tab, keeping that tab running, and then using chrome://media-internals.

inside chrome://media-internals Tab, click the video URL (to expand it), scroll down and click Player Properties, You should find kVideoDecoderName Attributes:

Google Chrome MojoVideoDecoder Linux

in case kVideoDecoderName Value is MojoVideoDecoder (Previously GpuVideoDecoder, but now MojoVideoDecoder Used on Linux), it means that the video currently playing on YouTube in other tabs is using hardware accelerated video decoding. All other kVideoDecoderName values ​​(VpxVideoDecoder, FFmpegVideoDecoder and Dav1dVideoDecoder) mean that videos played in other browser tabs are being rendered using software.

Source

Sidebar