[FFmpeg-devel] [PATCH] avformat/matroskaenc: add matroska subtitle muxer (.mks)

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Sat Apr 4 10:24:14 EEST 2020


Jan Chren (rindeal):
> Signed-off-by: Jan Chren (rindeal) <dev.rindeal at gmail.com>
> ---
>  libavformat/matroskaenc.c | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
> index 5dae53026d8..62127fe97f0 100644
> --- a/libavformat/matroskaenc.c
> +++ b/libavformat/matroskaenc.c
> @@ -2793,3 +2793,31 @@ AVOutputFormat ff_matroska_audio_muxer = {
>      .priv_class        = &mka_class,
>  };
>  #endif
> +
> +#if CONFIG_MATROSKA_SUBTITLE_MUXER
> +static const AVClass mks_class = {
> +    .class_name = "matroska subtitle muxer",
> +    .item_name  = av_default_item_name,
> +    .option     = options,
> +    .version    = LIBAVUTIL_VERSION_INT,
> +};
> +AVOutputFormat ff_matroska_subtitle_muxer = {
> +    .name              = "matroska",
> +    .long_name         = NULL_IF_CONFIG_SMALL("Matroska Subtitles"),
> +    .extensions        = "mks",
> +    .priv_data_size    = sizeof(MatroskaMuxContext),
> +    .subtitle_codec    = AV_CODEC_ID_ASS,
> +    .init              = mkv_init,
> +    .deinit            = mkv_deinit,
> +    .write_header      = mkv_write_header,
> +    .write_packet      = mkv_write_flush_packet,
> +    .write_trailer     = mkv_write_trailer,
> +    .check_bitstream   = mkv_check_bitstream,
> +    .flags             = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS |
> +                         AVFMT_TS_NONSTRICT | AVFMT_ALLOW_FLUSH,
> +    .codec_tag         = (const AVCodecTag* const []){
> +        additional_subtitle_tags, 0
> +    },
> +    .priv_class        = &mks_class,
> +};
> +#endif

Another base64 encoded email. I have therefore added the decoded mail
for everyone's convenience.

What is the aim of your patch? If it is simply making sure that using
the mks extension autoselects the Matroska muxer, then adding "mks" to
the list of extensions of the ordinary Matroska muxer would be enough.
(Notice that using mka for files with audio, but without video or mks
for subtitle-only files is just a convention; putting something else
than indicated by the extension in the files does not make them less
spec-compliant.)

And how did you test that your patch achieves your aim? Because again,
it shouldn't. You did not abide by the checklist [1] and therefore this
new muxer will never be used (in fact, it won't even be compiled by
default).

- Andreas

[1]: https://ffmpeg.org/developer.html#New-codecs-or-formats-checklist


More information about the ffmpeg-devel mailing list