avfilter: let single output frame A->V filters set reasonable frame rate

This commit is contained in:
Paul B Mahol 2022-04-10 22:39:12 +02:00
parent 7ac559b819
commit 6e45acd23b
2 changed files with 7 additions and 2 deletions

View File

@ -1241,6 +1241,8 @@ static int config_output(AVFilterLink *outlink)
int ret = av_parse_video_rate(&s->frame_rate, s->rate_str);
if (ret < 0)
return ret;
} else if (s->single_pic) {
s->frame_rate = av_make_q(1, 1);
} else {
s->frame_rate = s->auto_frame_rate;
}

View File

@ -437,8 +437,11 @@ static int config_output(AVFilterLink *outlink)
outlink->h = showwaves->h;
outlink->sample_aspect_ratio = (AVRational){1,1};
outlink->frame_rate = av_div_q((AVRational){inlink->sample_rate,showwaves->n},
(AVRational){showwaves->w,1});
if (showwaves->single_pic)
outlink->frame_rate = av_make_q(1, 1);
else
outlink->frame_rate = av_div_q((AVRational){inlink->sample_rate,showwaves->n},
(AVRational){showwaves->w,1});
av_log(ctx, AV_LOG_VERBOSE, "s:%dx%d r:%f n:%d\n",
showwaves->w, showwaves->h, av_q2d(outlink->frame_rate), showwaves->n);