lavc/ratecontrol: use AVCodecContext.framerate when available

This commit is contained in:
Anton Khirnov 2023-05-04 10:59:18 +02:00
parent e930b834a9
commit dc20baa049
1 changed files with 3 additions and 0 deletions

View File

@ -57,6 +57,9 @@ void ff_write_pass1_stats(MpegEncContext *s)
static double get_fps(AVCodecContext *avctx)
{
if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
return av_q2d(avctx->framerate);
return 1.0 / av_q2d(avctx->time_base) / FFMAX(avctx->ticks_per_frame, 1);
}