Commit c7ecd599b3 for ffmpeg
commit c7ecd599b37991fa556048a09605d6df5be9d4e0
Author: James Almer <jamrial@gmail.com>
Date: Wed Nov 4 10:30:13 2026 -0300
avformat/matroskadec: always use the coded sample rate for intial padding
Demuxers should not add considerations for an eventual post-decoding state, and
only export coded parameters.
Ensures timestamps are properly calculated.
Before:
Output #0, framecrc, to 'pipe:':
Metadata:
encoder : Lavf63.18.100
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
encoder : Lavc63.26.100 pcm_s16le
ENCODER_OPTIONS : --bitrate 96
0, -27, -27, 648, 2592, 0x372ff818
0, 621, 621, 960, 3840, 0x53577417
[...]
0, 94701, 94701, 960, 3840, 0x56c74d8c
0, 95661, 95661, 312, 1248, 0x67d480ff
video:0KiB audio:375KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
size= 6KiB time=00:00:01.99
After:
Output #0, framecrc, to 'pipe:':
Metadata:
encoder : Lavf63.18.100
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
encoder : Lavc63.26.100 pcm_s16le
ENCODER_OPTIONS : --bitrate 96
0, 0, 0, 648, 2592, 0x372ff818
0, 732, 732, 960, 3840, 0x53577417
[...]
0, 95321, 95321, 960, 3840, 0x56c74d8c
0, 95688, 95688, 312, 1248, 0x67d480ff
video:0KiB audio:375KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown
size= 6KiB time=00:00:02.00
Signed-off-by: James Almer <jamrial@gmail.com>
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index d36cc5c345..706a0566bc 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2912,8 +2912,7 @@ static int mka_parse_audio(MatroskaTrack *track, AVStream *st,
if (track->codec_delay > 0) {
par->initial_padding = av_rescale_q(track->codec_delay,
(AVRational){1, 1000000000},
- (AVRational){1, par->codec_id == AV_CODEC_ID_OPUS ?
- 48000 : par->sample_rate});
+ (AVRational){1, par->sample_rate});
sti->skip_samples = par->initial_padding;
}
if (track->seek_preroll > 0) {