Commit 272113c66a for ffmpeg
commit 272113c66a55730d236051d73a40fe3905fb25e1
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Thu Nov 12 12:17:02 2026 -0800
avformat/movenc: exclude cover images from the movie timescale
Cover images have no timeline, but their 90 kHz time base could inflate
the common movie timescale.
Fixes: 51f5f60443eec9944c9d0cf24e0766edf403d7ef
Assisted-by: Fairy
Signed-off-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 1fc420d22d..1b74a24147 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -9367,7 +9367,9 @@ static int mov_init(AVFormatContext *s)
track->par = st->codecpar;
}
- movie_timescale = av_gcd_q(movie_timescale, st->time_base, INT_MAX, (AVRational){1,0});
+ /* Cover images are metadata and have no presentation timeline. */
+ if (!is_cover_image(st))
+ movie_timescale = av_gcd_q(movie_timescale, st->time_base, INT_MAX, (AVRational){1,0});
}
if (!movie_timescale.den)
movie_timescale = MOV_TIMESCALE_Q;
diff --git a/tests/ref/fate/mov-cover-image b/tests/ref/fate/mov-cover-image
index 426995fb02..0294f44ecc 100644
--- a/tests/ref/fate/mov-cover-image
+++ b/tests/ref/fate/mov-cover-image
@@ -1,4 +1,4 @@
-aa426fe7d8fd5eba040d4027e706e66e *tests/data/fate/mov-cover-image.mp4
+333894fa0eb8b42b73a2b68fb30dfe0d *tests/data/fate/mov-cover-image.mp4
1024065 tests/data/fate/mov-cover-image.mp4
#extradata 0: 2, 0x00340022
#tb 0: 1/44100