Linux and hardware-accelerated video decoding in browsers does not go hand-in-hand with each other. While there are a few workarounds, VAAPI is the most trusted way to enable hardware-accelerated video decode in Chrome. Let us learn how to do that. Remember that this method is only for intel integrated graphics. So do not try this if you have any other graphics card. Also, please remember that this method might not work on all devices and at all times.
Step 1 - Use the terminal to install some pre-requisites
At first, we need to install some drivers and other pre-requisites. Follow the given steps to install them -
-- For Gen 7 and earlier Intel hardware, open up the terminal and type the following
command -
sudo apt install i965-va-driver-shaders libva-drm2 libva-x11-2
This command will install the i965 driver and libva utils required by VAAPI to function properly.
-- For Gen 8 and later Intel hardware, open up the terminal and type the following command -
sudo apt install intel-media-va-driver-non-free libva-drm2 libva-x11-2
This command installs the non-free version of intel-media-va-driver and libva utils.
We recommend that you restart your PC after implementing the above-given steps.
Step 2 - Enable VAAPI in Chrome
Before we go into the actual VAAPI enabling process, let us check first if Chrome has the direct way enabled for hardware-accelerated video decode. For checking this, open up Chrome, type chrome://flags in the address bar, and press enter. After that, search for the Override software rendering list in the 'Search Flags' search bar. Enable Override software rendering list if it is on Disabled or Default. Reboot your Browser if it asks for it.
Similarly, after completing the above-given step, search for Hardware-accelerated video decode in the 'Search Flags' search box inside chrome://flags. If a Hardware-accelerated video decode option shows, then enable it and restart your browser. This should enable Hardware-accelerated video decode in your Chrome Browser. If the 2nd flag is not present, then you might have to use another longer and more tedious process, which is given below.
Step 3 (if the above-given steps do not work) - Using the terminal to enable VAAPI in Chrome
If there is no Hardware-accelerated video decode flag in your chrome://flags page, then follow the steps given below -
-- Follow Step 1 and Step 2 (till enabling Override software rendering list) if you had not done so earlier.
-- After doing that, close your Chrome Browser.
-- Open up your terminal and type the following command -
google-chrome-stable --use-gl=desktop --enable-features=VaapiVideoDecoder
This should launch Chrome with WebGL and VAAPI enabled.
Then you need to install an extension called enhanced-h264ify. After that open up the extension from the Chrome toolbar and uncheck every option except Block AV1. This will block all AV1 codec videos and convert them to other formats like VP9, which have better hardware acceleration support.
After doing these two steps, you need to check whether hardware-accelerated video decode is working or not. To do that, open up YouTube and play any video. After that, right-click anywhere on the page and click on 'Inspect'. After doing this, a new window will pop up. After that, click on the 'three-dots' in the top right corner. Go to 'More tools' and then click on 'Media'. Click on the name of the video playing from the dialog box (there would be a play logo also present there indicating a currently playing video). Then take a look at the 'Video Decoder' section. If the 'Hardware decoder' is marked as 'true', then congratulations! Your video playback is finally hardware accelerated.
Make the change permanent
To make this change permanent, so that it remains enabled by default, follow the given steps:
-- Close your existing open Chrome Windows.
-- Open 'Files' and go into your root directory.
-- Go to /usr/share/applications and then copy the google-chrome.desktop file.
-- From your Home directory, go to ~/.local/share/applications (remember to first enable Show hidden files from the top right hamburger menu) and paste the file.
-- Then open the newly pasted file from the destination directory using a text editor.
-- Inside the file, replace 'Exec=/usr/bin/google-chrome-stable %U'
to
'Exec=/usr/bin/google-chrome-stable --use-gl=desktop --enable- features=VaapiVideoDecoder %U'.
-- Save the file and reboot the PC.
Now that you have done all these steps correctly, chances are that your video playback will now be hardware-accelerated. You can check it in the same way as given above.
Read More -
Comments