This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new e8a4d1ca5c avformat/assdec: Treat negative-duration events as comments
e8a4d1ca5c is described below

commit e8a4d1ca5cfa50ff87bd17a565d75a6534ac6359
Author:     arch1t3cht <[email protected]>
AuthorDate: Sun May 17 18:28:05 2026 +0200
Commit:     rcombs <[email protected]>
CommitDate: Wed May 20 10:10:38 2026 +0000

    avformat/assdec: Treat negative-duration events as comments
    
    Subtitle events with duration <= 0 may be generated by some authoring
    scripts like karoke templates, and are simply treated as hidden by
    renderers.
    
    Parsing such subtitle events normally will cause the <= 0 duration to
    get mangled by ff_subtitles_queue_finalize() and later
    compute_pkt_fields(), causing rendering differences.
    
    Hence, treat such events like comments instead by adding them to the
    header so that they are preserved during remuxes, albeit in a different
    order.
    
    Signed-off-by: arch1t3cht <[email protected]>
---
 libavformat/assdec.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index 3a8353f4d3..607c64ef6d 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -72,6 +72,15 @@ static int read_dialogue(ASSContext *ass, AVBPrint *dst, 
const uint8_t *p,
         *start = (hh1*3600LL + mm1*60LL + ss1) * 100LL + ms1;
         *duration = end - *start;
 
+        /* Events with duration <= 0 are output by some authoring scripts and
+         * are simply treated as hidden by renderers. We cannot output such
+         * events as actual packets since this would cause their duration to be
+         * guessed by later processing like compute_pkt_fields().
+         * Hence, such events are written to the header like non-dialogue
+         * events like comments are. */
+        if (*duration <= 0)
+          return -1;
+
         av_bprint_clear(dst);
         av_bprintf(dst, "%u,%d,%s", ass->readorder++, layer, p + pos);
         if (!av_bprint_is_complete(dst))

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

Reply via email to