PR #26068 opened by Baptiste Coudurier (bcoudurier)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26068
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26068.patch

Carry trailing discard padding into the final audio sample duration written to 
a fragment. Fragmented outputs with an open-ended edit cannot use a finite edit 
duration to express this trim.


>From 610cff1a83d5b1441b2e174da46465ae1dd1046b Mon Sep 17 00:00:00 2001
From: Baptiste Coudurier <[email protected]>
Date: Sat, 14 Nov 2026 11:24:36 -0800
Subject: [PATCH] avformat/movenc: shorten fragmented audio runs for discard
 padding

Signed-off-by: Baptiste Coudurier <[email protected]>
---
 libavformat/movenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index c3fa66d816c..87a0cd12056 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -7540,6 +7540,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
                                  trk->st->time_base);
         if (duration < 0)
             return AVERROR_INVALIDDATA;
+        if ((mov->flags & FF_MOV_FLAG_FRAGMENT) && AV_RL32(sd->data + 4))
+            pkt->duration = duration;
     } else
         duration = pkt->duration;
 
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to