Dynamic bitrate, change bitrate while game is running

I am trying to change the bitrate while game is running. What is the right way to do that? Setting dwNewAvgBitrate = newlowerrate and passing to NvIFRTransferRenderTargetToH264HWEncoder is not doing anything.

I am also interested in doing a dynamic bitrate adjustment without having to destroy/instantiate a whole new encoder. Is this possible using the GRID SDK?

Yes the NVENC can support changing dynamic bitrate, resolution, is supported, and that is also reflected in the GRID API call as well.

If just changing the bitrate, make sure that you are also setting parameters.

NV_IFROGL_HW_ENC_PARAMS params
params.flags = NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_BITRATE_CHANGE;
params.newAvgBitrate = (your new Avg bitrate)
params.newVBVInitialDelay = (your new VBV Initial Delay)
params.newVBVBufferSize = (your new VBV Buffer Size)

If you just want to change the resolution.
params.flags = NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_RESOLUTION_CHANGE;
params.newWidth = (new encoder width)
params.newHeight = (new encoder height)

If you want to change both resolution and bitrate, the flags must be both set).
params.flags = (NV_IFROGL_HW_ENC_PARAM_FLAGS)(NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_RESOLUTION_CHANGE | NV_IFROGL_HW_ENC_PARAM_FLAG_DYN_BITRATE_CHANGE);

Then change both parameters.

NV_IFROGL_HW_ENC_PARAMS is an NvIFR struct. We’re primarily using NvFBC for our encoding. Are NvFBC and NvIFR interchangeable for setting up parameters or is there an equivalent params struct for NvFBC that we need to set?

by setting .dwFlags = NVFBC_TOH264_NOFLAGS by default the encoder will wait for a change on the screen to finish the encoder api call. until then the thread is in a wait state.

is there a way to exit this wait state other than triggering a change or terminating the calling process?