whexy1999
Hardware-accelerated Video Decoding in Chrome

Hardware-accelerated Video Decoding in Chrome

Created
Dec 23, 2022 09:24 PM
Last edited time
Dec 25, 2022 01:36 AM
Tags

Current State

In 2022, most video comes with H265 and AV1. For now, only MPEG, H264, VC1, and VP9 are supported in the transformation driver
vdpau-va-driver-vp9
xtknightUpdated Jul 31, 2023
.
nvidia-vaapi-driver
elFartoUpdated Aug 30, 2023
has a lot of potential. It bases on NVDEC, which is a new API provided by Nvidia. But it will crash Chrome because of limited support
Chrome Support
Updated Aug 30, 2023
.
The fundamental reason that we are in this stage is Nvidia and Google are both too stubborn to support each other.
Here it is again. Google doesn't want to add specific code for Nvidia's GPUs because there are so many other GPUs on the market that it would be a lot of work to support all of them. Meanwhile, Nvidia wants to provide specific functionality through its own unique API.
We need an abstraction layer for GPUs! Luckily we have DirectX in Windows, Metal in macOS, and Vulkan in Linux. And Vulkan is expected to support AV1 in 2023. So I believe Chrome will have a good hardware-accelerated video decode solution soon or later.
Developers of Chrome also said in June 2022, “VaapiVideoDecoder is in the process of shipping with Vulkan support now.”
But before that, let’s see how we can add limited support for hardware video decoding to Chrome in 2022.

VA_API transformation driver

⚠️ 2022-12-24 UPDATE: The hardware decoder is extremely unstable. I gave up.
First, install the VDPAU→VA_API transform driver
Use vainfo, you shall see the driver.

Chrome settings

Use the following command to start Chrome (I use the beta version, you can use the stable version as well):
In the Chrome flag settings, enable these:
  • Override software rendering list
  • GPU rasterization
  • Zero-copy rasterizer
  • Hardware decode acceleration for k-SVC VP9

Check

Relaunch Chrome, and open chrome://gpu to check if Video Decode is hardware accelerated.
notion image
That’s not enough. Play a Youtube video and press F12. Click More Options More tools Media to open the Media panel. Check if the hardware decoder is true.
💡
Notice that the hardware decoder won’t always be available due to the limitation of GPU-supported decoding formats. But it should work in most cases.
notion image