[FFmpeg-devel] [PATCH 3/3] lavf/utils: avoid giving up probing early with long subtitle events

Rodger Combs rodger.combs at gmail.com
Sun Sep 20 19:29:33 CEST 2015


---
 libavformat/utils.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 199e80b..0256894 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3343,7 +3343,12 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
                 break;
             }
             if (pkt->duration) {
-                st->info->codec_info_duration        += pkt->duration;
+                if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) {
+                    if (pkt->pts != AV_NOPTS_VALUE)
+                        st->info->codec_info_duration = pkt->pts - st->start_time;
+                } else {
+                    st->info->codec_info_duration    += pkt->duration;
+                }
                 st->info->codec_info_duration_fields += st->parser && st->need_parsing && st->codec->ticks_per_frame ==2 ? st->parser->repeat_pict + 1 : 2;
             }
         }
-- 
2.5.1



More information about the ffmpeg-devel mailing list