diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index e0f2fe138f..3ca93fc8fa 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -2088,9 +2088,11 @@ 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 && copy_ts) - start_time += f->start_time; + start_time = 0; + if (copy_ts) { + start_time += f->start_time != AV_NOPTS_VALUE ? f->start_time : 0; + start_time += start_at_zero ? 0 : f->ctx->start_time; + } if (ist->pts >= f->recording_time + start_time) { close_output_stream(ost); return;