diff --git a/ffmpeg.c b/ffmpeg.c index 2a9fe43bb7..18d2768221 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -1214,7 +1214,6 @@ static int reap_filters(void) { AVFrame *filtered_frame = NULL; int i; - int64_t frame_pts; /* Reap all buffers present in the buffer sinks */ for (i = 0; i < nb_output_streams; i++) { @@ -1247,10 +1246,10 @@ static int reap_filters(void) av_frame_unref(filtered_frame); continue; } - frame_pts = AV_NOPTS_VALUE; + if (filtered_frame->pts != AV_NOPTS_VALUE) { int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time; - filtered_frame->pts = frame_pts = + filtered_frame->pts = av_rescale_q(filtered_frame->pts, filter->inputs[0]->time_base, enc->time_base) - av_rescale_q(start_time, AV_TIME_BASE_Q, enc->time_base); } @@ -1259,7 +1258,6 @@ static int reap_filters(void) switch (filter->inputs[0]->type) { case AVMEDIA_TYPE_VIDEO: - filtered_frame->pts = frame_pts; if (!ost->frame_aspect_ratio.num) enc->sample_aspect_ratio = filtered_frame->sample_aspect_ratio; @@ -1272,7 +1270,6 @@ static int reap_filters(void) do_video_out(of->ctx, ost, filtered_frame); break; case AVMEDIA_TYPE_AUDIO: - filtered_frame->pts = frame_pts; if (!(enc->codec->capabilities & CODEC_CAP_PARAM_CHANGE) && enc->channels != av_frame_get_channels(filtered_frame)) { av_log(NULL, AV_LOG_ERROR,