diff options
author | Jun Zhao <barryjzhao@tencent.com> | 2019-04-27 18:52:57 +0800 |
---|---|---|
committer | Jun Zhao <barryjzhao@tencent.com> | 2019-05-11 00:10:55 +0800 |
commit | 68bac50604a52760ccb9d9dd43f100436fd66b71 (patch) | |
tree | 678ddd8e9b3070baee2778278fb27201cc56f9e8 /libavcodec/libx265.c | |
parent | 1e6338c2da7779f68c28cdb4d46ef0729d464bc0 (diff) | |
download | ffmpeg-68bac50604a52760ccb9d9dd43f100436fd66b71.tar.gz |
lavc/libx265: Use avctx->framerate first for frame rate setting
perfer avctx->framerate first than use avctx->time_base when setting
the frame rate to encoder. 1/time_base is not the average frame rate
if the frame rate is not constant, so use avctx->framerate if the
value is not zero.
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
Diffstat (limited to 'libavcodec/libx265.c')
-rw-r--r-- | libavcodec/libx265.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index fe39f45241..07bca81aef 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -110,8 +110,13 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) } ctx->params->frameNumThreads = avctx->thread_count; - ctx->params->fpsNum = avctx->time_base.den; - ctx->params->fpsDenom = avctx->time_base.num * avctx->ticks_per_frame; + if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { + ctx->params->fpsNum = avctx->framerate.num; + ctx->params->fpsDenom = avctx->framerate.den; + } else { + ctx->params->fpsNum = avctx->time_base.den; + ctx->params->fpsDenom = avctx->time_base.num * avctx->ticks_per_frame; + } ctx->params->sourceWidth = avctx->width; ctx->params->sourceHeight = avctx->height; ctx->params->bEnablePsnr = !!(avctx->flags & AV_CODEC_FLAG_PSNR); |