diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-05-04 11:13:04 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-05-15 10:32:05 +0200 |
commit | aa3b0f437674ebad01c01212fa7f6895b8e3a7dd (patch) | |
tree | 3d15f0d6ebcab68fa509ea1690734352260ae178 /libavcodec/libaomenc.c | |
parent | 3fabf712070cb060a01e93d70dbdf837f0efa98e (diff) | |
download | ffmpeg-aa3b0f437674ebad01c01212fa7f6895b8e3a7dd.tar.gz |
libaomenc: use AVCodecContext.framerate when available
Diffstat (limited to 'libavcodec/libaomenc.c')
-rw-r--r-- | libavcodec/libaomenc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/libaomenc.c b/libavcodec/libaomenc.c index 0b88102c77..1d3a4ae64c 100644 --- a/libavcodec/libaomenc.c +++ b/libavcodec/libaomenc.c @@ -1295,8 +1295,12 @@ static int aom_encode(AVCodecContext *avctx, AVPacket *pkt, if (frame->duration > ULONG_MAX) { av_log(avctx, AV_LOG_WARNING, "Frame duration too large: %"PRId64"\n", frame->duration); - } else - duration = frame->duration ? frame->duration : avctx->ticks_per_frame; + } else if (frame->duration) + duration = frame->duration; + else if (avctx->framerate.num > 0 && avctx->framerate.den > 0) + duration = av_rescale_q(1, av_inv_q(avctx->framerate), avctx->time_base); + else + duration = avctx->ticks_per_frame ? avctx->ticks_per_frame : 1; switch (frame->color_range) { case AVCOL_RANGE_MPEG: |