---
 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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to