Commit 7d27a946cb for ffmpeg
commit 7d27a946cba38bc0f25338ace9876a4adaa4e9a2
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Mon Nov 23 08:22:02 2026 +0000
avformat/movenc: avoid shifting buffered E-AC-3 DTS twice at EOF
Buffered packets already reached the track DTS domain before aggregation. Restore the input DTS before sending the remainder through the single-packet writer.
Assisted-by: Fairy
Signed-off-by: Baptiste Coudurier <baptiste.coudurier@gmail.com>
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 726f36ab4f..242decec69 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -9770,6 +9770,9 @@ static int mov_write_trailer(AVFormatContext *s)
continue;
av_packet_move_ref(mov->pkt, info->pkt);
+ /* mov_write_single_packet() expects DTS before its track shift. */
+ if (trk->dts_shift != AV_NOPTS_VALUE)
+ mov->pkt->dts -= trk->dts_shift;
info->eof = 1;
res = mov_write_single_packet(s, mov->pkt);
if (res < 0)