diff --git a/doc/content/encoding_formats.md b/doc/content/encoding_formats.md index ff1f1ef037..a2db0cd52e 100644 --- a/doc/content/encoding_formats.md +++ b/doc/content/encoding_formats.md @@ -143,7 +143,9 @@ The encoder should support all the options for `ffmpeg`'s [muxers](https://ffmpe ```liquidsoap %ffmpeg(format="mpegts", %audio(codec="ac3",channel_coupling=0), - %video(codec="libx264",b="2600k",preset="ultrafast")) + %video(codec="libx264",b="2600k", + "x264-params"="scenecut=0:open_gop=0:min-keyint=150:keyint=150", + preset="ultrafast")) ``` The full syntax is as follows: @@ -161,6 +163,7 @@ Where: * `` is either a string value (e.g. `"mpegts"`), as returned by the `ffmpeg -formats` command or `none`. When set to `none` or simply no specified, the encoder will try to auto-detect it. * `` is either a string value (e.g. `"libmp3lame"`), as returned by the `ffmpeg -codecs` command or `none`. When set to `none`, for audio, `channels` is set to `0` and, for either audio or video, the stream is assumed to have no such content. +* `` can be any syntactically valid variable name or string. Strings are typically used when the option name is of the form: `foo-bar`. * `%audio(..)` is for options specific to the audio codec. Unused options will raise an exception. Any option supported by `ffmpeg` can be passed here. * `%video(..)` is for options specific to the video codec. Unused options will raise an exception. Any option supported by `ffmpeg` can be passed here. * Generic options are passed to audio, video and format (container) setup. Unused options will raise an exception. Any option supported by `ffmpeg` can be passed here. diff --git a/src/lang/lang_parser.mly b/src/lang/lang_parser.mly index 4b674ec025..91a6f2cb39 100644 --- a/src/lang/lang_parser.mly +++ b/src/lang/lang_parser.mly @@ -446,10 +446,18 @@ ogg_item: | FLAC app_opt { Lang_flac.make_ogg $2 } | top_level_ogg_item { $1 } +ffmpeg_param: + | STRING GETS expr { $1,$3 } + | VAR GETS expr { $1,$3 } +ffmpeg_params: + | { [] } + | ffmpeg_param { [$1] } + | ffmpeg_param COMMA ffmpeg_params { $1::$3 } + ffmpeg_list_elem: - | AUDIO LPAR app_list RPAR { `Audio $3 } - | VIDEO LPAR app_list RPAR { `Video $3 } - | VAR GETS expr { `Option ($1,$3) } + | AUDIO LPAR ffmpeg_params RPAR { `Audio $3 } + | VIDEO LPAR ffmpeg_params RPAR { `Video $3 } + | ffmpeg_param { `Option $1 } ffmpeg_list: | { [] } | ffmpeg_list_elem { [$1] }