[FFmpeg-devel] [PATCH] avcodec/utils: ensure conversion from ass to ass_with_timings works with unknown durations

Aman Gupta ffmpeg at tmm1.net
Tue Jun 14 19:51:22 CEST 2016


From: Aman Gupta <aman at tmm1.net>

the eia_608 decoder with real_time=1 emits subtitles with an unknown
duration, which were getting converted into ass incorrectly before this
patch.
---
 libavcodec/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 402a9d8..1047a74 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2554,7 +2554,7 @@ static int convert_sub_to_old_ass_form(AVSubtitle *sub, const AVPacket *pkt, AVR
 
         /* rescale timing to ASS time base (ms) */
         ts_start = av_rescale_q(pkt->pts, tb, av_make_q(1, 100));
-        if (pkt->duration != -1)
+        if (pkt->duration != -1 && sub->end_display_time != -1)
             ts_duration = av_rescale_q(pkt->duration, tb, av_make_q(1, 100));
         sub->end_display_time = FFMAX(sub->end_display_time, 10 * ts_duration);
 
-- 
2.8.1



More information about the ffmpeg-devel mailing list