2.0.x release cycle, liquidsoap integrates a tight support of ffmpeg. This includes:
Ffmpeg support includes 3 types of content:
- Internal content, that is content available to all liquidsoap operators:
- Raw content, that is decoded content but stored as ffmpeg internal frame. This type of content is only available to ffmpeg filters and raw encoders. It can be used to avoid data copies back and forth between liquidsoap and ffmpeg.
- Copy content, that is encoded content stored as ffmpeg internal packets. This type of content is only available to ffmpeg copy encoder and bitstream filters and requires a fairly good understanding of media codecs and containers. Copy contents can be used to avoid transcoding and pass encoded data end-to-end inside liquidsoap scripts.
Enabling ffmpeg support
FFmpeg support is available via the external ocaml-ffmpeg binding package. If you are using any binary asset from our release pages or via docker, this should already be included.
If you are installing via opam, installing the
ffmpeg package should do the trick:
% opam install ffmpeg
For the most part, you should never have to worry about the
ffmpeg decoder. When enabled, it should be the preferred decoder for all supported media. When using raw or copied content, the decoder is able to produce the required content without the need of any intervention on the user part.
Should you need to tweak it, here are a couple of pointers:
settings.decoder.decoders settings controls which decoders are to be used when trying to decode media files. You can use it to restrict which decoders are being used, for instance making sure only the ffmpeg decoder is used:
Priority for the decoder is set via:
You can use this setting to adjust wether or not the ffmpeg decoder should be tried first when decoding media files, in particular in conjunction with the other
For each type of media codec, the
settings.decoder.ffmpeg.codecs.* settings can be used to tell
ffmpeg which decoder to use to decode this type of content (there could more than one decoder for a given codec).
For instance, for the
settings.decoder.ffmpeg.codecs.aac.available()returns the list of available decoders, typically
settings.decoder.ffmpeg.codecs.aac.setcan be used to choose which decoder should be used, typically:
When debugging issues with
ffmpeg, it can be useful to increase the log verbosity.
This settings sets the verbosity of
ffmpeg logs. Possible values, from less verbose to more verbose are:
Please note that, due to a technical limitation, we are not yet able to route
ffmpeg logs through the liquidsoap logging facilities, which means that
ffmpeg logs are currently only printed to the process’s standard output and that the
settings.ffmpeg.log.level is currently not used.
See detailed ffmpeg encoders article.
See detailed ffmpeg filters article.
FFmpeg bitstream filters are filters that modify the binary content of encoded data. They can be used to adjust certain aspects of media codecs and containers to make them fit some specific use, for instance a rtmp/flv output etc. They are particularly important when dealing with live switches of encoded content (see Examples section).
% liquidsoap -h ffmpeg.filter.bitstream.h264_mp4toannexb for more FFmpeg h264_mp4toannexb bitstream filter. See ffmpeg documentation details. source(audio='a, Type: (?id : string?, video=ffmpeg.video.copy('b), midi=none)) -> source(audio='a, video=ffmpeg.video.copy('b), midi=none) Category: Source / FFmpeg Filter Flag: extra Parameters: * id : string? (default: null) Force the value of the source ID. source(audio='a, video=ffmpeg.video.copy('b), midi=none) * (unlabeled) : Methods:...
Please consult the FFmpeg documentation for more details about that each filter do and why/how to use them.
See detailed ffmpeg cookbook article.