[FFmpeg-devel] [PATCH 07/13] lavc/ratecontrol: use AVCodecContext.framerate when available

Anton Khirnov anton at khirnov.net
Sun May 7 16:32:49 EEST 2023


---
 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);
 }
 
-- 
2.39.2



More information about the ffmpeg-devel mailing list