I want to change bitrate in NVENC but it always return NV_ENC_ERR_INVALID_VERSION error.
My codes as bellow,the current_init_params is the value which set in nvEncInitialzeEncode.The init phrase is OK and stream encoding is OK too.
NV_ENC_INITIALIZE_PARAMS init_params = current_init_params;
init_params.encodeConfig->rcParams.averageBitRate = client_requested_bitrate * 1000;
init_params.encodeConfig->rcParams.maxBitRate = client_requested_bitrate * 1000;
init_params.encodeConfig->rcParams.maxBitRate = client_requested_bitrate * 1000;
init_params.encodeConfig->rcParams.vbvBufferSize = 2 * (client_requested_bitrate * 1000) / frameRate;
NV_ENC_RECONFIGURE_PARAMS reconfigure_params { 0 };
reconfigure_params.version = NV_ENC_RECONFIGURE_PARAMS_VER;
reconfigure_params.reInitEncodeParams = init_params;
reconfigure_params.resetEncoder = 0;
reconfigure_params.forceIDR = 0;
if (nvenc_failed(nvenc->nvEncReconfigureEncoder(encoder, &reconfigure_params))) {
//log error here,always get here
}
and hareward is RTX 4070,driver version is 552.44 ,OS: WINDOWS 10(21H2)
and NVENC defins as bellow:
define NVENCAPI_MAJOR_VERSION 12
define NVENCAPI_MINOR_VERSION 0
define NV_ENC_RECONFIGURE_PARAMS_VER (NVENCAPI_STRUCT_VERSION(1) | ( 1u << 31 ))