Enable Video hardware Acceleration in Chrome / Chromium / Firefox on Ubuntu 20.04


This post keep tracking my test enabling video hardware acceleration on Ryzen 2200g and Intel i5-6500 using integrated graphic card.

Table of Contents

  1. Quick Guide
  2. Testing Video Hardware Acceleration
    1. GPU Supported Video Codec
    2. Use CloudReady to Test
    3. Test Procedure
    4. CloudReady Test Result
  3. Terminology
    1. Vulkan, VA-API, & VD-PAU
    2. ANGLE
  4. Installation & Configuration
    1. GPU Drivers
    2. Monitor Tools
    3. Chrome & Chromium
    4. FireFox
  5. Final Thoughts
  6. Reference

Quick Guide

  1. No huge performance advantage when hardware accelerated video decode has been enabled in Chomre/chromium on i5-6500 and J3455. The CPU usage is still high to me.
  2. Fail to enable hardware accelerated video decode with Ryzen 2200g
  3. It’s easier to test using CloudReady to know if the hardware accelerated video decode feature in Chrome/Chromium is supported.
  4. Some video issues if hardware accelerated video decode is enabled on Ubuntu 20.04LTS.

Testing Video Hardware Acceleration

Most GPUs have special circutes to decode known video formats. If the hardware accelerated video decode in a software player is enabled and the GPU supports the video format, it uses less CPU. A low-power CPU may play video smoothly with the help of GPU.

However, it’s complex to enable in Chrome/Chromium on Ubuntu 20.04LTS. Some terminology, tools, and tips would help:

  1. Linux video driver architecture
  2. Chrome/Chromium Experiments tricks
  3. Chrome/Chromium command line parameter tricks
  4. Monitor tools for CPU/GPU usage

After spending so much time, I realize the easiest way is to use CloudReady. It is enabled while running on supported hardware.

GPU Supported Video Codec

I use following resources to identify which hardware accelerated video decode is supported by a GPU:

  1. Intel Graphics Technology: 5 Capabilities (GPU video acceleration)
  2. Unified Video Decoder is for AMD decode while Video Coding Engine is for encode.
  3. Nvidia PureVideo

Use CloudReady to Test

Google has created Chrome OS to run on low powered hardware. It is based on Linux. Even a Celeron 2995u in Asus ChromeBox CN62 plays YouTube FHD smoothly.

Neverware is a Google company who has created CloudReady. It is based on the open source Chromium OS. I can explore the tweaks and see if hardware accelerated video decode is supported by running CloudReady.

To create a CloudReady boot drive, get a fast 8GB flash drive and the 64-bit image file. Then I follow the steps to use Chromebook Recovery Utility to create a bootable flash drive from the image file. It boots up without any issues. When I use CloudReady USB Maker to prepare, it never boots.

Chromebook Recovery Utility only restores the image to the flash. Neither resizing the partition to utilize the full flash storage nor creating extra storage partition. I need to clear the “Cached images and files” using the “Clear browsing data” dialog in Chromium frequently to prevent the storage shortage warning.

It can also erases a CloudReady flash. Much more quickly then delete 29 partitions by GParted manually.

Test Procedure

Boot with CloudReady Live and login, launch a Chromium window, install h264ify, and open the following tabs:

  1. chrome://gpu
  2. chrome://flags
  3. chrome://sys-internals/#CPU
  4. [Settings] ➞ [Privacy and security] ➞ [Clear browsing data]
  5. Youtube: 【4K】Tokyo Evening Walk – From Shibuya to Omote-sando, 2020

On the video page, use the right mouse on the video to open [Stats of nerds] to identify the “Codecs” being played. It could be avc1, vp09, or av01. The default format is av01 or vp09. Enable h264ify to force to use avc1.

Next, open [︙] ➞ [More tools] ➞ [Developer tools]. In the side panel, [︙] ➞ [More tools] ➞ [Media] to display detail information about the video, especially the “Decode Name” and “Hardware Decoder” in “Video Decoder” section.

An avc1 video played with the [Stats of nerds] and the media information on ThinkPad L460

chrome://gpu ➞ “Graphics Feature Status” ➞ “Video Decode” indicates are software or hardware accelerated decoding.

chrome://gpu ➞ “Version Information” ➞ “Command Line” displays flags. They are parameters to launch Chrome/Chromium in Terminal on Linux. Some have detail description in chrome://flags.

chrome://sys-internals/#CPU is the only way to monitor CPU usage in CloudReady. I haven’t found any tools to monitor GPU video decode.

CloudReady Test Result

i5-6500 with Intel HD Graphics 530

chrome://gpu with hardware accelerated video decode.

chrome://gpu with software video decode.

i5-9400f with nVidia gt720

chrome://gpu with hardware accelerated video decode.

J3455

chrome://gpu with hardware accelerated video decode.

Ryzen 2200g

chrome://gpu with software video decode.

Terminology

There are many new terminology while reading posts. It’s easy to confuse video hardware accelerated and video decode hard accelerated. The former is for general display while the latter is supported video format decode.

Vulkan, VA-API, & VD-PAU

Vulkan, VA-API, and VD-PAU are all video APIs. Video software needs to access GPU through these APIs. Vulkan is for applications while the others are video codecs.

ANGLE

ANGLE is similiar to Vulkan for redneings rather than providing codecs.

Installation & Configuration

After testing with CloudReady, I might need to install extra driver/kernel module to provide the right VA-API and VD-PAU. Sometimes it works with certain version number only.

Monitor tools help to check GPU usage. When the GPU usage increase after enabling video decode hardware acceleration, the CPU usage should decrease.

GPU Drivers

Linux has build-in support for Intel, AMD, and nVidia. It’s not necessary to install additional driver for Intel and AMD. But nVidia gt720 needs, the defaul driver plays videos like slow motion.

For AMD GPU running on Ubuntu 20.04, follow here or search from the upper [DRIVERS AND SUPPORT] menu to install the AMD proprietary OpenGL, OpenCL, and Vulkan drivers. It’s not necessary for APU (processors with graphics).

Here is the detail steps. To remove, run ./amdgpu-install --uninstall to uninstall. There is no such file “amdgpu-uninstall”.

Monitor Tools

There is an intel_gpu_top to monitor Intel GPU. I didn’t see anything related to video decode.

$sudo apt install intel-gpu-tools
$sudo intel_gpu_top

There is also a radeontop for AMD. Again, nothing related to video decode.

$sudo apt install radeontop
$sudo radeontop

nvidia-smi ships with NVIDIA GPU display drivers on Linux. It provides memory usage, GPU utilization, and temperature.

If the GPU is decoding, the GPU usage should increase while the CPU decrease. I also use the build-in System Monitor to check.

More discussion is in askUbuntu. If you know any tools to monitor GPU video decode, please shared in comments.

Chrome & Chromium

In Chrome, open chrome://flags and enable following flags:

  • Override software rendering list
  • GPU rasterization
  • Zero-copy rasterizer

Launch with “$google-chrome --enable-features=VaapiVideoDecoder” in a terminal. Open chrome://gpu and it should indicate “Video Decode: Hardware accelerated”.

The “--enable-features=VaapiVideoDecoder” in chrome-flags.conf will be ignored. It needs to be specified in command line.

For Chromium, replace google-chrome by chromium in command line. Others are the same.

For detail steps, check How To Enable Hardware Accelerated Video Decode In Google Chrome, Brave, Vivaldi And Opera Browsers On Debian, Ubuntu Or Linux Mint and [HowTo] Enable Hardware Video Acceleration / Video Decode In Google Chrome, Brave, Vivaldi And Opera Browsers.

For ArcLinux, following links are very useful hardware video accleration resources for Chrome/Chromium and other applications:

  1. Chromium: 2.5 Hardware video acceleration
  2. Hardware video acceleration
  3. GDM
  4. GStreamer: 3.4 Hardware video acceleration
  5. FFmpeg: 2.13 Hardware video acceleration

FireFox

To enable hardware acceleration, open “about:config” page and enable “layers.acceleration.force-enabled”. Video is not video codec. It doesn’t help on video decoding.

To enable VA-API support, enable “media.ffmpeg.vaapi.enabled”. This is for video decoding.

Final Thoughts

I have successfully enable “Video Decode: Hardware accelerated” on an i5-6500 running Ubuntu 20.04.

While watching supported video formats on YouTube, I didn’t see any indicators change dramagically in intel_gpu_top. System Monitor also doesn’t show any decreasing on CPU usage, either.

On a ThinkPad L460 with i5-6200u and HD520 running Windows 10, I have enable video decode acceleration on Chrome 91.0.4472.101 but the appliend workaround “disable_accelerated_vp9_decode” diables it again. Neither avc1 aka h.264 nor vp9 videos have hardware decode accelerated. Firefox 89.0 has 1 to 4% GPU video decode usages on avc1 videos.

Some said they have lower CPU usage considerably with limited version of Chrome / Chromium. Once upgrade, it’s gone.

I decide to ignore hardware accelerated video decode on Linux. It’s easier to use CloudReady to watch YouTube on a slow computer.

Reference

  1. Wiki: Intel Graphics Technology: 5 Capabilities (GPU video acceleration)
  2. Wiki: Unified Video Decoder
  3. Wiki: Video Coding Engine
  4. Wiki: Nvidia PureVideo
  5. Neverware: CloudReady for Home: Free Download
  6. Neverware: Install Guide
  7. Chrome Web Store: Chromebook Recovery Utility
  8. Chrome Web Store: h264ify
  9. Youtube: 【4K】Tokyo Evening Walk – From Shibuya to Omote-sando, 2020
  10. Wiki: Wilkan (API)
  11. Wiki: Video Acceleration API
  12. Wiki: VD-PAU
  13. Wiki: ANGLE (software)
  14. AMD: Radeon™ Software for Linux® 21.10 Release Notes
  15. AMD: DRIVERS AND SUPPORT
  16. GitHub: clbr / radeontop
  17. nVidia DEVELOPER: NVIDIA System Management Interface
  18. askUbuntu: How to measure GPU usage?
  19. Read the Docs: Radeon™ Software for Linux® Installation
  20. Linux Uprising: How To Enable Hardware Accelerated Video Decode In Google Chrome, Brave, Vivaldi And Opera Browsers On Debian, Ubuntu Or Linux Mint
  21. Manjaro Team: [HowTo] Enable Hardware Video Acceleration / Video Decode In Google Chrome, Brave, Vivaldi And Opera Browsers
  22. ArchLinux: Chromium: 2.5 Hardware video acceleration
  23. ArchLinux: Hardware video acceleration
  24. ArchLinux: GDM
  25. ArchLinux: GStreamer: 3.4 Hardware video acceleration
  26. ArchLinux: FFmpeg: 2.13 Hardware video acceleration

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.