Using chromium-ffmpeg in third-party browser snaps

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 connections chromium-ffmpeg
Interface  Plug  Slot                                    Notes
content    -     chromium-ffmpeg:chromium-ffmpeg-95241   -
content    -     chromium-ffmpeg:chromium-ffmpeg-98516   -
content    -     chromium-ffmpeg:chromium-ffmpeg-103551  -
content    -     chromium-ffmpeg:chromium-ffmpeg-104195  -

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

  • FFMpeg 95241 : chromium 77
  • FFMpeg 98516 : chromium 84
  • FFMpeg 103551 : chromium 93
  • FFMpeg 104195 : chromium 94

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

plugs:
  chromium-ffmpeg-103551:
    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-103551 chromium-ffmpeg:chromium-ffmpeg-103551

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-requests category to make the case for the auto-connection.

3 Likes

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

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

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

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

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

1 Like

@oSoMoN is some user action needed after installing both chromium and chromium-ffmpeg or does it work automatically?

The chromium snap doesn’t need chromium-ffmpeg, it already contains the codecs.

1 Like

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

1 Like

@oSoMoN will you be posting new versions of chromium-ffmpeg soon?

Yes, I’m working on updates, sorry for the delay.

Updated the documentation for a new major version of chromium (93) with its corresponding FFMpeg revision (103551).

1 Like

Updated the documentation for a new major version of chromium (94, currently in the beta channel) with its corresponding FFMpeg revision (104195).