the stream

H.264/AAC in Vivaldi on arm64 Raspberry Pi OS

Alexander Bochmann Friday 01 of July, 2022
The Vivaldi web browser has an arm64 version that runs on the recently released arm64 port of Raspberry Pi OS. Unfortunately, out of the box, this version doesn't support a lot of media formats, and relies - same as Chromium, which Vivaldi is built on - on an external decoder library for some of them.

Now the Vivaldi distribution comes with a downloader script for that shared library at /opt/vivaldi/update-ffmpeg. As of right now, the script doesn't find a valid file for arm64 though. Looking at the code, it fetches a custom version of a Debian/Ubuntu package for chromium-codecs-ffmpeg-extra from Launchpad. As it turns out, Raspberry Pi OS ships an own version of exactly that deb, which installs a version of the required library to /usr/lib/chromium-browser/libffmpeg.so. This is great, except that it's not a place where Vivaldi looks for the file.

Vivaldi itself is started through an own wrapper script that's installed to /usr/bin/vivaldi. The wrapper has a few places where it tries to LD_PRELOAD a matching libffmpeg.so from, one of which is a custom location below the current user's ~/.local/ directory, involving the checksum of the expected library version. Luckily, the checksum is not actually checked - it's just used as part of the directory name.

So I came up with the following one-liner to create that directory for the current user and drop a symlink to Raspbian's chromium codec file:

grep -A1 arm64 /usr/bin/vivaldi | awk -F'=' '/FFMPEG_SUM_DEB/ { cmd="mkdir -p ~/.local/lib/vivaldi/media-codecs-"$2" ; ln -s /usr/lib/chromium-browser/libffmpeg.so ~/.local/lib/vivaldi/media-codecs-"$2"/libffmpeg.so" ; system(cmd) }'

This fetches a few candidate lines from the Vivaldi startup wrapper, finds the one that has the required checksum, and runs it through awk to create directory and symlink.

I have not yet tried to find out if the expected checksum changes between Vivaldi versions, but unless there's a major change in /usr/bin/vivaldi, I can just run the command again to create a new directory in the required location.

Note this doesn't provide Widevine or other DRM codecs, but at least I can now play back videos that have been reencoded to H.264/AAC by Mastodon.

(I have pretty much the same information over in a Fediverse thread.)