I'm trying to use my existing Raspberry Pi 4 with 4 Gb of RAM as media player for various video content - local and from online web services.
Modern Ubuntu MATE 21.10 ships Chromium as Snap, so traditional methods does not work for it. As first step one should remove Snap version of Chromium by sudo snap remove chromium
.
Possible workaround is to install Chromium using the same deb-package as RaspberryPi OS provides.
It is done by using commands below:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E
sudo apt-add-repository "deb http://archive.raspberrypi.org/debian/ bullseye main"
cat <<EOF | sudo tee /etc/apt/preferences.d/pin-chromium
Package: *
Pin: release o=Raspberry Pi Foundation
Pin-Priority: -1
Package: chromium*
Pin: release o=Raspberry Pi Foundation
Pin-Priority: 1000
EOF
sudo apt-get update
sudo apt-get install chromium-browser
Then launch Chromium to configure it as usual - enable the following options on chrome://flags
:
- Override software rendering list aka
#ignore-gpu-blocklist
; - GPU rasterization aka
#enable-gpu-rasterization
; - Zero-copy rasterizer aka
#enable-zero-copy
; - Enables Display Compositor to use a new gpu thread. aka
#enable-drdc
; - Out-of-process 2D canvas rasterization. aka
#canvas-oop-rasterization
.
Relaunch it using chromium-browser --enable-features=VaapiVideoDecoder
, visit chrome://gpu
to ensure that you have all (excluding Vulkan) options enabled:
Graphics Feature Status
- Canvas: Hardware accelerated
- Canvas out-of-process rasterization: Enabled
- Compositing: Hardware accelerated
- Multiple Raster Threads: Enabled
- Out-of-process Rasterization: Hardware accelerated
- OpenGL: Enabled
- Rasterization: Hardware accelerated on all pages
- Skia Renderer: Enabled
- Video Decode: Hardware accelerated
- Vulkan: Disabled
- WebGL: Hardware accelerated
- WebGL2: Hardware accelerated
To make --enable-features=VaapiVideoDecoder
flag permanent one should edit the relevant config-file programmatically as shown below:
echo 'CHROMIUM_FLAGS="${CHROMIUM_FLAGS} --enable-features=VaapiVideoDecoder"' | sudo tee /etc/chromium.d/92-vaapi-hardware-decoding
As the result all web-players will play 1080p without lags and tearing.