Using chromium-ffmpeg in third-party browser snaps


#1

The chromium snap ships FFMpeg codecs that allow decoding videos in many popular formats, including VP8, VP9, H.264 and Theora.

Other third-party browser snaps or snaps that embed a webview based on chromium may not be allowed to redestribute those codecs for legal reasons. For those, there is a chromium-ffmpeg content snap that exposes slots which snaps can connect to to see a copy of the desired version of libffmpeg.so.

The provider declares several slots:

$ snap interfaces chromium-ffmpeg
Slot                                   Plug
chromium-ffmpeg:chromium-ffmpeg-91124  -
chromium-ffmpeg:chromium-ffmpeg-91696  -
chromium-ffmpeg:chromium-ffmpeg-92142  -
chromium-ffmpeg:chromium-ffmpeg-92393  -
chromium-ffmpeg:chromium-ffmpeg-92972  -

Each slot has an FFMpeg version number in its name, which corresponds to a given chromium release.

  • FFMpeg 91124 : chromium 67
  • FFMpeg 91696 : chromium 68
  • FFMpeg 92142 : chromium 69
  • FFMpeg 92393 : chromium 70
  • FFMpeg 92972 : chromium 71

A consumer snap needs to declare a corresponding plug in its snapcraft.yaml file:

plugs:
  chromium-ffmpeg-92972:
    interface: content
    target: $SNAP
    default-provider: chromium-ffmpeg

Once the connection is made, the consumer will see libffmpeg.so mounted at $SNAP/chromium-ffmpeg/libffmpeg.so. By appending $SNAP/chromium-ffmpeg to LD_LIBRARY_PATH (or whatever other shared library loading mechanism the consumer uses to look up and load libffmpeg.so), the codecs will be made available to the application.

To make the connection:

snap connect <consumer-snap-name>:chromium-ffmpeg-92972 chromium-ffmpeg:chromium-ffmpeg-92972

Note that consumer snaps that are in the store can request an assertion to be set up so that the connection will be made automatically when the snap is installed. To enable this, the maintainer of the snap should create a forum post in the store category to make the case for the auto-connection.


#2

Updated the documentation as there is a new major version of chromium (69) with its corresponding FFMpeg revision (92142).


#3

Updated the documentation as there is a new major version of chromium (70) with its corresponding FFMpeg revision (92393).