obs-ffmpeg: Fix bitrate being set on NVENC CQP/lossless

This commit is contained in:
jp9000 2019-02-26 07:43:38 -08:00
parent ca6561758c
commit dccf686150

View File

@ -409,8 +409,6 @@ static bool init_encoder(struct nvenc_data *enc, obs_data_t *settings)
params->encodeConfig = &enc->config;
params->maxEncodeWidth = voi->width;
params->maxEncodeHeight = voi->height;
config->rcParams.averageBitRate = bitrate * 1000;
config->rcParams.maxBitRate = vbr ? max_bitrate * 1000 : bitrate * 1000;
config->gopLength = gop_size;
config->frameIntervalP = 1 + bf;
h264_config->idrPeriod = gop_size;
@ -455,6 +453,9 @@ static bool init_encoder(struct nvenc_data *enc, obs_data_t *settings)
config->rcParams.constQP.qpIntra = cqp;
enc->can_change_bitrate = false;
bitrate = 0;
max_bitrate = 0;
} else if (astrcmpi(rc, "vbr") != 0) { /* CBR by default */
h264_config->outputBufferingPeriodSEI = 1;
h264_config->outputPictureTimingSEI = 1;
@ -463,6 +464,9 @@ static bool init_encoder(struct nvenc_data *enc, obs_data_t *settings)
: NV_ENC_PARAMS_RC_CBR;
}
config->rcParams.averageBitRate = bitrate * 1000;
config->rcParams.maxBitRate = vbr ? max_bitrate * 1000 : bitrate * 1000;
/* -------------------------- */
/* profile */