[FFmpeg-cvslog] avformat/matroskaenc: Use native id V_FFV1 instead of V_MS/VFW/FOURCC

Andreas Rheinhardt git at videolan.org
Wed May 28 04:21:04 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun May 25 04:26:20 2025 +0200| [96d4bcbcd81f18e4538f139fb86d52d41981c4be] | committer: Andreas Rheinhardt

avformat/matroskaenc: Use native id V_FFV1 instead of V_MS/VFW/FOURCC

Up until now, our muxer wrote FFV1 in video-for-windows
compatibility mode out of concern for old demuxers that
only support that (whereas the demuxer accepts V_FFV1).
This commit switches to using native mode, because
a) V_FFV1 is around long enough so that old demuxers
should not be an issue (support in FFmpeg has been added
in commit 9ae762da7e256aa4d3b645c614fcd1959e1cbb8d
in March 2017/FFmpeg 3.3),
b) using native mode uses fewer bytes for the CodecPrivate,
c) the VfW extradata is zero-padded to an even length
if necessary, but our demuxer forgot to undo the padding
until very recently (92e310eb82e04713e55d248b65c22f0eb95afada),
so that there are many versions of our demuxer around that
are buggy wrt VFW, but not V_FFV1.
This affects the FFV1 extradata checksums, specifically
the (experimental) version 4 files with error check version 2*
as created by
ffmpeg -i ../fate-suite/mpeg2/sony-ct3.bs -c:v ffv1 \
-slices 16 -frames 1 -level 4 -strict experimental ffv1.mkv
VFW files like the above created by this muxer before this patch
would not work with an old demuxer.

*: Without error check version 2, the CRC for the whole extradata
is zero, which is not changed by appending a zero byte.

Reviewed-by: compn <ff at hawaiiantel.net>
Reviewed-by: Dave Rice <dave at dericed.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=96d4bcbcd81f18e4538f139fb86d52d41981c4be
---

 libavformat/matroskaenc.c                          | 4 ++--
 tests/ref/fate/matroska-mastering-display-metadata | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 9d13f74907..408890fa89 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1960,8 +1960,8 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv,
 
         // look for a codec ID string specific to mkv to use,
         // if none are found, use AVI codes
-        if (par->codec_id == AV_CODEC_ID_FFV1 || par->codec_id == AV_CODEC_ID_JPEG2000) {
-            /* FFV1 and JPEG2000 are actually supported natively in Matroska,
+        if (par->codec_id == AV_CODEC_ID_JPEG2000) {
+            /* JPEG2000 is actually supported natively in Matroska,
              * yet we use the VfW way to mux it for compatibility
              * with old demuxers. (FIXME: Are they really important?) */
         } else if (par->codec_id != AV_CODEC_ID_RAWVIDEO || par->codec_tag) {
diff --git a/tests/ref/fate/matroska-mastering-display-metadata b/tests/ref/fate/matroska-mastering-display-metadata
index 5984f54131..6f10dc57a6 100644
--- a/tests/ref/fate/matroska-mastering-display-metadata
+++ b/tests/ref/fate/matroska-mastering-display-metadata
@@ -1,5 +1,5 @@
-c1e5e2ecf433cf05af8556debc7d4d0b *tests/data/fate/matroska-mastering-display-metadata.matroska
-1669773 tests/data/fate/matroska-mastering-display-metadata.matroska
+bdca53906b34c57192416a0f737b885e *tests/data/fate/matroska-mastering-display-metadata.matroska
+1669723 tests/data/fate/matroska-mastering-display-metadata.matroska
 #extradata 0:        4, 0x040901a3
 #extradata 3:      201, 0x9a706279
 #tb 0: 1/1000



More information about the ffmpeg-cvslog mailing list