[FFmpeg-devel] [PATCH] ffmpeg: When streamcopying, only add the input seek position when copying timestamps.

Simon Thelen ffmpeg-dev at c-14.de
Sun Nov 22 15:03:17 CET 2015


Using -ss as an input option shifts timestamps down by the seek, so it
doesn't have to be added to the recording time when checking whether to
stop.

Fixes #977

Signed-off-by: Simon Thelen <ffmpeg-dev at c-14.de>
---
 ffmpeg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index bf5e983..6658fb2 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1831,7 +1831,7 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
 
     if (f->recording_time != INT64_MAX) {
         start_time = f->ctx->start_time;
-        if (f->start_time != AV_NOPTS_VALUE)
+        if (f->start_time != AV_NOPTS_VALUE && copy_ts)
             start_time += f->start_time;
         if (ist->pts >= f->recording_time + start_time) {
             close_output_stream(ost);
-- 
2.6.3



More information about the ffmpeg-devel mailing list