Ubuntu supports testing Chromium Snap using VAAPI (hardware accelerated video decoding)

Ubuntu is testing a new Chromium snap software package, which supports VAAPI, so that web browsers can take advantage of hardware-accelerated video decoding.
Owned by specification developer Olivier Tilloy Being created Fedora uses Chromium snapshots with VAAPI enabled patch (Obtained Chromium’s VAAPI support about 2 weeks ago) and posted it on the new candidate / vaapi channel. Therefore, Ubuntu and other Linux distributions with Snap support can easily install Chromium with the Video Acceleration API enabled, which will result in smoother video playback, less CPU usage and higher power consumption. Edit: This no longer works. You can install the snap package, but it no longer has the hardware-accelerated video decoding function (error report). Currently, the only way to get VAAPI support for the Chromium web browser on Ubuntu is to use Chromium with the VAAPI patch PPA.

Chromium VAAPI-enabled snapshot running in Ubuntu 18.04-please pay attention to low CPU usage when playing YouTube videos

VAAPI (Video Acceleration API) uses the GPU to enable and provide access to hardware-accelerated video processing to accelerate video encoding and decoding by offloading processing from the CPU.
Just like on Fedora, Chromium VAAPI snapshots have a “hardware accelerated video decoding” logo (in chrome://flags) Is enabled by default, so you do n’t need to do anything to enable GPU accelerated video decoding.
However, some GPUs do not support hardware acceleration of certain codecs (such as VP8 or VP9), so in this case, hardware acceleration cannot be used immediately. In the case of YouTube, users can force the video to use h264 instead of VP8 / VP9 supported by most GPUs, so you will get hardware accelerated video decoding. This can be done by installing h264ify Chrome extension.
There is another important aspect to mention. Although by default, hardware acceleration is used with Intel GPUs through Chromium VAAPI snapshots (I also assume AMD GPUs, but since there are none, I cannot try them), Nvidia GPUs are not.
If the patch used by this Ubuntu snapshot and Fedora package is similar to that used for Chromium with VAAPI patch PPA, patched vdpau-va-driver (implementation vaQuerySurfaceAttributes) To enable hardware-accelerated video decoding in Chromium running on Nvidia graphics. Since this feature cannot be used directly in Ubuntu, Chromium VAAPI snapshots will be built without this feature, so in this case, hardware-accelerated video decoding is not applicable to Nvidia GPUs. Either way, this Chromium snapshot cannot provide GPU accelerated video decoding via Nvidia graphics.
As an alternative, Ubuntu / Linux Mint users with Nvidia GPUs (or users who do not wish to use the Chromium snap package) can install VAAPI-enabled Chromium using PPA, which provides a patched vdpau-va driver.

Chrome snapshot and VAAPI installation

Snapshot of Chromium with VAAPI is located at candidate/vaapi Snapshot channel, not in Ubuntu software or Snapshot storage. To install it, you can use the command line:

sudo snap install --channel=candidate/vaapi chromium

In Linux distributions where snapshots are not enabled by default, you can find instructions on installing / enabling snapshots in the following locations: snapcraft.io.
You can check whether Chromium is using hardware-accelerated video decoding by watching its CPU usage while playing the video, which should be much lower than using the standard Chromium build version. To ensure this, you can open the video on YouTube, then open a new tab in Chromium, and enter the following in the URL bar: chrome://media-internals .Chromium snap GPUVideoDecoder video_decoder media inside

In chrome://media-internals Tab, click on the video URL to expand it, scroll down and click Player Properties, You should find video_decoder Attributes. in case video_decoder Value is GpuVideoDecoder This means that the video currently playing on YouTube on other tags is using hardware-accelerated video decoding.
If it shows FFmpegVideoDecoder Or VpxVideoDecoder, The accelerated video decoding does not work properly, or the GPU you are using does not support the accelerated video decoding of VP8 / VP9, ​​but you forget to install or disable it h264ify Chrome extension.
Through Phoenix