[FFmpeg-devel] [PATCH] avformat/concatdec: Handle NOPTS start_time

Michael Niedermayer michaelni at gmx.at
Mon Dec 15 18:22:32 CET 2014


Fixes Ticket3598

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavformat/concatdec.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index a2584d7..253951a 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -512,9 +512,14 @@ static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt)
            av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base),
            av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base));
 
-    delta = av_rescale_q(cat->cur_file->start_time - cat->avf->start_time,
-                         AV_TIME_BASE_Q,
-                         cat->avf->streams[pkt->stream_index]->time_base);
+    if (cat->avf->start_time == AV_NOPTS_VALUE)
+        delta = av_rescale_q(cat->cur_file->start_time,
+                             AV_TIME_BASE_Q,
+                             cat->avf->streams[pkt->stream_index]->time_base);
+    else
+        delta = av_rescale_q(cat->cur_file->start_time - cat->avf->start_time,
+                             AV_TIME_BASE_Q,
+                             cat->avf->streams[pkt->stream_index]->time_base);
     if (pkt->pts != AV_NOPTS_VALUE)
         pkt->pts += delta;
     if (pkt->dts != AV_NOPTS_VALUE)
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list