From dc20baa0491d190a68d73f4da931205490e344bb Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 4 May 2023 10:59:18 +0200 Subject: [PATCH] lavc/ratecontrol: use AVCodecContext.framerate when available --- libavcodec/ratecontrol.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index 6a40f9cbdc..890ae33cb3 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -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); }