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 redistribute 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, for example:
$ snap connections chromium-ffmpeg
Interface Plug Slot Notes
content - chromium-ffmpeg:chromium-ffmpeg-114023 -
content - chromium-ffmpeg:chromium-ffmpeg-115016 -
Each slot has an FFMpeg version number in its name, which corresponds to a given chromium release. This correspondence is noted down as comments to the slots section of /snap/chromium-ffmpeg/current/snap/snapcraft.yaml
.
A consumer snap needs to declare a corresponding plug in its snapcraft.yaml
file, for example:
plugs:
chromium-ffmpeg-115016:
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, first check the currently available slots from chromium-ffmpeg with snap connections chromium-ffmpeg
. For example, at the time of writing:
Interface Plug Slot Notes
content - chromium-ffmpeg:chromium-ffmpeg-115016 -
content - chromium-ffmpeg:chromium-ffmpeg-115541 -
Then connect to a desired slot.
snap connect <consumer-snap-name>:chromium-ffmpeg-115016 chromium-ffmpeg:chromium-ffmpeg-115016
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. He might want to specifically ask for a slot-unespecific assertion so that he does not have to make requests for each new chromium-ffmpeg slot.