diff options
author | Gyan Doshi <ffmpeg@gyani.pro> | 2018-06-18 12:09:54 +0530 |
---|---|---|
committer | Gyan Doshi <ffmpeg@gyani.pro> | 2018-06-19 10:25:04 +0530 |
commit | f27b02621d9352206f1b797ba1a979aaadcb6ae6 (patch) | |
tree | e2ecfd92c703b38b3a1a05e6004b707fed4d508a /libavcodec/libx265.c | |
parent | 98e18910a3f19a1139654b2d14d0f3b2b3625cd1 (diff) | |
download | ffmpeg-f27b02621d9352206f1b797ba1a979aaadcb6ae6.tar.gz |
avcodec/libx265: apply lavc maxrate, bufsize & rc_init_occupancy
CLI options -maxrate, -bufsize and -rc_init_occupancy can now be picked
up by the x265 wrapper. Min. rc init has to be 1001 to avoid x265
setting it to vbv-bufsize.
Diffstat (limited to 'libavcodec/libx265.c')
-rw-r--r-- | libavcodec/libx265.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index bb457dfe5a..27c90b323f 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -205,6 +205,9 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) ctx->params->rc.rateControlMode = X265_RC_ABR; } + ctx->params->rc.vbvBufferSize = avctx->rc_buffer_size / 1000; + ctx->params->rc.vbvMaxBitrate = avctx->rc_max_rate / 1000; + if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)) ctx->params->bRepeatHeaders = 1; @@ -233,6 +236,11 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx) } } + if (ctx->params->rc.vbvBufferSize && avctx->rc_initial_buffer_occupancy > 1000 && + ctx->params->rc.vbvBufferInit == 0.9) { + ctx->params->rc.vbvBufferInit = (float)avctx->rc_initial_buffer_occupancy / 1000; + } + if (ctx->profile) { if (ctx->api->param_apply_profile(ctx->params, ctx->profile) < 0) { int i; |