diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-05-04 10:59:18 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-05-15 10:32:05 +0200 |
commit | dc20baa0491d190a68d73f4da931205490e344bb (patch) | |
tree | 80c60ae67f8cd87096beddadba8f64d4a323537e | |
parent | e930b834a928546f9cbc937f6633709053448232 (diff) | |
download | ffmpeg-dc20baa0491d190a68d73f4da931205490e344bb.tar.gz |
lavc/ratecontrol: use AVCodecContext.framerate when available
-rw-r--r-- | libavcodec/ratecontrol.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); } |