[FFmpeg-devel] [PATCH]lavf/matroskaenc: Do not write 0 duration for subtitles

Carl Eugen Hoyos ceffmpeg at gmail.com
Sun Nov 12 04:12:12 EET 2017


Hi!

Attached patch by John Stebbins fixes a warning with mkvalidator here.

Please comment, Carl Eugen
-------------- next part --------------
From dab79ea5cd01187567b1761aaf1c329926483786 Wed Oct 29 00:00:00 2014
From: John Stebbins <stebbins at jetheaddev.com>
Date: Wed, 29 Oct 2014 10:54:44 -0700
Subject: [PATCH] lavf/matroskaenc: Fix writing zero duration subtitles

The matroska spec says blockduration == 0 means the frame is not a
keyframe.  Since all subtitles are "keyframes", 0 blockduration should
not be written.

Fixes mkvalidator error messages for PGS subtitles.
---
 libavformat/matroskaenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index dad6d6c..61ce0f7 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -2396,7 +2396,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
             /* All subtitle blocks are considered to be keyframes. */
             mkv_write_block(s, pb, MATROSKA_ID_BLOCK, pkt, 1);
-            put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration);
+            if (duration > 0)
+                put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration);
             end_ebml_master(pb, blockgroup);
         }


-- 
1.9.3




More information about the ffmpeg-devel mailing list