How to get smooth youtube/flash video playback on Raspberry Pi (updated 22-Nov-2021)
The Raspberry Pi is a tiny singleboard computer with a great potential. Its VideoCore GPU has a very interesting ability to make web surfing more smooth and comfortable. This ability is not implemented in regular Raspbian image yet, so I decide to write this topic.
Chromium browser, the default browser in last Raspbian, doesn't use hardware acceleration of the ARM GPUs. So we need to provide fine tuning for that.
Option 1: create config file in ~/.config directory (not working currently on Raspbian):
cat << 'EOF' | tee ~/.config/chromium-flags.con
--flag-switches-begin --enable-gpu-rasterization --enable-features=VaapiVideoDecoder --flag-switches-end
EOFf
Option 2: create modified desktop shortcut:
cp /usr/share/applications/chromium-browser.desktop "$(xdg-user-dir DESKTOP)"
chmod +x "$(xdg-user-dir DESKTOP)/chromium-browser.desktop"
sed -i "s|Exec=chromium-browser|Exec=chromium-browser \
--enable-gpu-rasterization --enable-features=VaapiVideoDecoder|g" \
"$(xdg-user-dir DESKTOP)/chromium-browser.desktop"
Tested on Raspberry Pi 4 (4GB). On Raspbian with these settings 1080p on YouTube or HTML5 video playback is smooth and consumes about 38% CPU usage on all cores.
On Manjaro ARM (xfce) CPU consumption is higher - about 58% (1080p VP9 YouTube) and 50% (1080p H.264 HTML5 video) on all cores.
To fix random system hangs due to a small amount of RAM you can enable optimized swapping according to my article Effective Raspberry Pi ZRAM usage.
Sergey Kovalenko (c)
Email: seryoga.engineering@gmail.com
ETL Developer
5yHi Sergey, for what I undestand, if we have the newest Raspbian (Buster from 2019-09) there is needed to set only one thing: #enable-gpu-rasterization = Enabled I did it, but it doesnt change too much. Still 1080p are not smooth and CPU load is more then 70%. I enabled GL full KMS and H264 and it helps a little - CPU load is less then 50%, but still not smooth. (We can check it cliking on "Stats for Nerds" on movie in YT and check if codec is MP4 (VP8/9 if H264 disabled) Also both solutions have screen tearing. I have no idea how you get 17% CPU load and smooth for 1080p.'
Tendering Manager at GE
6yHi Sergey, for the flag “#ignore-gpu-blacklist", will we set it to "Enabled" or "Disabled"? When I set "Enabled" for both above flags, youtube cannot play any video and it displays error (see photo attached). When I set “#enable-gpu-rasterization= Enabled" and set ““#ignore-gpu-blacklist = Disabled", then the youtube video can play quite smoothly, but the sound from the video is not good, sound is still lag, interruptive and not so smooth. (h264ify extension of Chromium is kept enabled in my case) Thank you for your support.
Consultant/Enterprise Solution Architect
6yGreat article article. We used Chromium 65 as that one had stable video support. can you suggest which Raspbian OS version and which chromium version did you use ?
Principal at Prohs Technology
6yThanks for this info! Does this apply to the Raspberry Pi 4?