Skip to content

Instantly share code, notes, and snippets.

@ruario
Last active October 12, 2021 11:10
Show Gist options
  • Save ruario/55a6671b155fe1da35a8d8a5b2352008 to your computer and use it in GitHub Desktop.
Save ruario/55a6671b155fe1da35a8d8a5b2352008 to your computer and use it in GitHub Desktop.
Proprietary Media for Vivaldi 2.9 and above on Linux. A guide for package maintainers

Proprietary Media for Vivaldi 2.9 and above on Linux. A guide for package maintainers

From Vivaldi (for Linux) 2.9 onwards the way that proprietary media support is handled has changed. The official (deb/rpm) packages run a script called update-ffmpeg (that is included with Vivaldi) as part of the post install process.

This script fetches and installs a suitable proprietary media enabled libffmpeg.so and places it in “/var/opt/vivaldi/media-codecs-$CHROMIUM_VERSION/libffmpeg.so” (where CHROMIUM_VERSION roughly matches the Chromium version of Vivaldi).

When Vivaldi launches the (bash-based) startup wrapper script looks for the presence of this file and if it finds it, then it will use LD_PRELOAD to load this in preference to limited lib that ships within the package (lib/libffmpeg.so).

For maintainers of unofficial Vivaldi install packages on non deb/rpm distros such as Arch, Gentoo, Solus, Slackware, etc., the following are suggestions as to how to handle the new situation:

  1. Offer your own proprietary media enabled libffmpeg.so. This could either be bundled with the Vivaldi repackage or as a seperate package that is listed as a dependency (or recommended package) – See: Providing a proprietary media enabled libffmpeg.so
  2. Call update-ffmpeg in post install (and update-ffmpeg --undo at pre or post uninstall). This will cause your package to work like the official (deb/rpm) packages, i.e. installation and removal of a suitable library will then be offloaded to this script
  3. Do nothing. If update-ffmpeg has not been run in post install, then the startup wrapper will not find a proprietary media enabled libffmpeg.so and it will set the variable VIVALDI_FFMPEG_FOUND to NO before launching Vivaldi. This in turn will cause Vivaldi to inform the user of the issue and guide them how to fix themselves (basically it tells them to run the script themselves).

Providing a proprietary media enabled libffmpeg.so

If you choose option “1.do not overwite “lib/libffmpeg.so” within the package, because doing so will bypass the startup wrapper's logic for setting the VIVALDI_FFMPEG_FOUND variable.

The startup wrapper assumes that the bundled copy is always limited. It is therefore better to save your file within the main Vivaldi install directory, named as “libffmpeg.so.$MAJOR.$MINOR”, where “$MAJOR.$MINOR” represents the first and second parts of the Vivaldi version number, e.g. for Vivaldi version 2.9.1705.41 the startup wrapper will look for a file named “libffmpeg.so.2.9”. If this is found, it will be preloaded in preference to the bundled “lib/libffmpeg.so” and the variable VIVALDI_FFMPEG_FOUND will be set to NO before launching Vivaldi (thus disabling the warning message to the user).

An example of distro that does this is Arch Linux https://aur.archlinux.org/packages/vivaldi-snapshot-ffmpeg-codecs/. The build instructions in the linked PKGBUILD could also be used as a guide as how to build a suitable library.

@ruario
Copy link
Author

ruario commented Nov 14, 2019

Gotcha… sorry I obviously read too fast

@ruario
Copy link
Author

ruario commented Nov 14, 2019

@bohwaz The script can actually download to two locations, depending on if the --user command line option is defined. I presume that running it as ./update-ffmpeg --user as your regular user would/does work for you?

@bohwaz
Copy link

bohwaz commented Nov 14, 2019

I didn't know about the --user option, but using sudo -E to keep the proxy environment worked out well.

@ruario
Copy link
Author

ruario commented Nov 14, 2019

Yeah I never documented it anywhere. I just added so that single user installs would work without the need for root

@ruario
Copy link
Author

ruario commented Mar 3, 2020

I now explain the --user option in more detail

@Firetouch
Copy link

Hi, I am using Deepin v20 beta and can install Vivaldi from their repository, but I am having problems Installing proprietary media support. I noticed the the scripts are not installed in the default directories /opt/vivaldi ... but in the media directory....Even when I run the scripts from that directory, still does not work. Could somebody share some light on the issue. Thanks.

@ruario
Copy link
Author

ruario commented May 5, 2020

@Firetouch Just restart your browser once and Vivaldi sets everything up for you. There is nothing for you to do

@Firetouch
Copy link

Firetouch commented May 5, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment