PR #24489 opened by James Almer (jamrial) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24489 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24489.patch
See https://github.com/ietf-wg-cellar/matroska-specification/commit/773bcbec6c7c49603525c6a39c74ed02849a3107 and https://github.com/ietf-wg-cellar/matroska-specification/commit/81ae497c34486e662ce3a597dd71357ef5a84c5e New output ``` $ ./ffmpeg -i multiple_itut_t35_mappings.mkv ffmpeg version N-126538-g09574528b5 Copyright (c) 2000-2026 the FFmpeg developers built with gcc 16.2.0 (Rev3, Built by MSYS2 project) configuration: --enable-gpl --enable-nonfree --enable-libxml2 --enable-libdav1d --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libaom --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzimg --disable-lzma --disable-avx512 --extra-cflags='-D_WIN32_WINNT=0xA00' --cpu=alderlake --cc='ccache cc' --samples=../samples --prefix=/mingw64 libavutil 61. 7.100 / 61. 7.100 libavcodec 63. 12.100 / 63. 12.100 libavformat 63. 6.100 / 63. 6.100 libavdevice 63. 2.100 / 63. 2.100 libavfilter 12. 4.100 / 12. 4.100 libswscale 10. 2.100 / 10. 2.100 libswresample 7. 3.100 / 7. 3.100 Input #0, matroska,webm, from 'multiple_itut_t35_mappings.mkv': Metadata: encoder : Lavf Duration: 00:00:00.04, start: 0.000000, bitrate: 2788 kb/s Stream #0:0: Video: vp9 (Profile 2), yuv420p10le(tv), 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn (default) Metadata: DURATION : 00:00:00.040000000 At least one output file must be specified ``` Old output ``` $ ./ffmpeg -i multiple_itut_t35_mappings.mkv ffmpeg version N-126537-g7523428c26 Copyright (c) 2000-2026 the FFmpeg developers built with gcc 16.2.0 (Rev3, Built by MSYS2 project) configuration: --enable-gpl --enable-nonfree --enable-libxml2 --enable-libdav1d --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libaom --enable-libwebp --enable-libx264 --enable-libx265 --enable-libzimg --disable-lzma --disable-avx512 --extra-cflags='-D_WIN32_WINNT=0xA00' --cpu=alderlake --cc='ccache cc' --samples=../samples --prefix=/mingw64 libavutil 61. 7.100 / 61. 7.100 libavcodec 63. 12.100 / 63. 12.100 libavformat 63. 6.100 / 63. 6.100 libavdevice 63. 2.100 / 63. 2.100 libavfilter 12. 4.100 / 12. 4.100 libswscale 10. 2.100 / 10. 2.100 libswresample 7. 3.100 / 7. 3.100 [in#0 @ 00000293d5af6fc0] Invalid Block Addition Value 0x5 for Block Addition Mapping Type 0x4, name "" Input #0, matroska,webm, from 'multiple_itut_t35_mappings.mkv': Metadata: encoder : Lavf Duration: 00:00:00.04, start: 0.000000, bitrate: 2788 kb/s Stream #0:0: Video: vp9 (Profile 2), yuv420p10le(tv), 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn (default) Metadata: DURATION : 00:00:00.040000000 At least one output file must be specified ``` The sample has HDR10+ and Closed Caption mapping and blockaddition payload. The CC is not exported as the demuxer has no code to handle it. It's `hdr10_plus_vp9_sample.webm` from the FATE suite remuxed with the addition of the CC mapping and payload. >From a51611d8e5227fbd7f722bf7eb1ae4a12231c86b Mon Sep 17 00:00:00 2001 From: James Almer <[email protected]> Date: Mon, 14 Sep 2026 10:44:56 -0300 Subject: [PATCH] avformat/matroskadec: add support for more than one BlockAdditionMapping of type ITU-T T.35 Signed-off-by: James Almer <[email protected]> --- libavformat/matroskadec.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 8e24433cf8..bceb4f7e17 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2534,8 +2534,25 @@ static int mkv_parse_block_addition_mappings(AVFormatContext *s, AVStream *st, M { const EbmlList *mappings_list = &track->block_addition_mappings; MatroskaBlockAdditionMapping *mappings = mappings_list->elem; + int nb_itutt35 = 0; int ret; + for (int i = 0; i < mappings_list->nb_elem; i++) { + MatroskaBlockAdditionMapping *mapping = &mappings[i]; + + switch (mapping->type) { + case MATROSKA_BLOCK_ADD_ID_TYPE_ITU_T_T35: + if (nb_itutt35 && mapping->extradata.size < 4) { + av_log(s, AV_LOG_ERROR, "One or more maps for BlockAddIDType 4 lack extradata\n"); + return AVERROR_INVALIDDATA; + } + nb_itutt35++; + break; + default: + break; + } + } + for (int i = 0; i < mappings_list->nb_elem; i++) { MatroskaBlockAdditionMapping *mapping = &mappings[i]; uint64_t type = mapping->type; @@ -2548,7 +2565,6 @@ static int mkv_parse_block_addition_mappings(AVFormatContext *s, AVStream *st, M type = MATROSKA_BLOCK_ADD_ID_TYPE_OPAQUE; av_fallthrough; case MATROSKA_BLOCK_ADD_ID_TYPE_OPAQUE: - case MATROSKA_BLOCK_ADD_ID_TYPE_ITU_T_T35: if (mapping->value != type) { int strict = s->strict_std_compliance >= FF_COMPLIANCE_STRICT; av_log(s, strict ? AV_LOG_ERROR : AV_LOG_WARNING, -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
