H.264 and AAC: building CEF yourself
riptide's releases use the prebuilt Chromium (CEF) from Spotify's CEF builds, which leaves out patented codecs, so riptide can't play H.264 video or AAC audio. You can build CEF with them yourself and drop the result into a riptide you unpacked from the .tar.gz release. riptide doesn't distribute such a build, because the codecs are patented.
Most people don't need this. If video stutters, try content.media.blocked_codecs first. H.264 helps mainly on GPUs that decode H.264 in hardware but not VP9 or AV1.
What it takes
- Linux on x86_64, with Python 3 and Git.
- About 45 GB of disk, and several hours of compiling.
- Memory: each compile job can use 2 GB or more. Six jobs fit in about 16 GB of free memory; twelve didn't.
1. Find the CEF version riptide uses
riptide --version
# riptide 0.22.0 (…, CEF 156.0.26+g8ea0c73+chromium-156.0.8078.88)
From that line you need the CEF branch, which is the third part of the Chromium version (8078), and the commit after the g (8ea0c73). The build has to match exactly, so redo it whenever a riptide release moves to another CEF version.
2. Download the sources
mkdir ~/cef-h264 && cd ~/cef-h264
curl -fLO https://raw.githubusercontent.com/chromiumembedded/cef/master/tools/automate/automate-git.py
export GN_DEFINES="proprietary_codecs=true ffmpeg_branding=Chrome is_official_build=false chrome_pgo_phase=0 symbol_level=0 blink_symbol_level=0 use_sysroot=true"
unset GOROOT GOPATH
python3 automate-git.py --download-dir="$PWD" --branch=8078 --checkout=8ea0c73 \
--no-chromium-history --no-build --no-distrib --x64-build --no-debug-build
proprietary_codecs and ffmpeg_branding=Chrome are what add H.264 and AAC. Unset GOROOT if your shell exports one: a Go other than Chromium's own breaks the build part-way through.
3. Build
(cd chromium/src/cef && ./cef_create_projects.sh)
export PATH="$PWD/depot_tools:$PATH"
grep -E 'proprietary_codecs|ffmpeg_branding' chromium/src/out/Release_GN_x64/args.gn
autoninja -j 6 -C chromium/src/out/Release_GN_x64 cefsimple
The grep should print both settings; if it doesn't, GN_DEFINES wasn't set when the projects were made. Raise -j if you have the memory. If the build stops, run the same autoninja line again and it carries on where it stopped.
4. Put it into riptide
Copy two files from the build into the folder you unpacked riptide into, over the ones there:
cp chromium/src/out/Release_GN_x64/{libcef.so,v8_context_snapshot.bin} ~/riptide-0.22.0/
Both are needed: with only libcef.so, pages crash as they open. Use the .tar.gz release for this rather than a package, since a package update puts the stock files back. Keep the originals if you want to undo it.
To check, open a page with an H.264 video. In the developer tools console, MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E"') is true once it worked. To make YouTube send H.264 rather than VP9 or AV1, block those two:
c.content.media.blocked_codecs = { "av1", "vp9" }
Once it works, ~/cef-h264 can be deleted, but you'll need it again for the next CEF version.