Reconfigure frame rate in realtime

Hi,

I’m trying to change video frame rate when encoding takes longer than frame rate.
For example, when I am encoding 4k video with captured textures at 30 fps, but encoding takes longer than 30 fps(over 0.0333 secs), then I want to change video frame rate and capture cycle(1/15 secs) to 15 fps.
The reason why I want to do like this is when I encode videos at 30 fps and 30 fps capture cycle(1/30 secs), I can see out of sync issue with audio as I can’t pass all textures for generating 30 fps video.

So now what I wanted to try is using nvEncReconfigureEncoder… but it doesn’t seem to be working for changing fps… Is there anything I need to add more here?

NVENCSTATUS CNvHWEncoder::NvEncReconfigureFrameRate(const int frameRate) {
	NVENCSTATUS nvStatus = NV_ENC_SUCCESS;	

	NV_ENC_RECONFIGURE_PARAMS stReconfigParams = {0};
	memset(&stReconfigParams, 0, sizeof(stReconfigParams));
	memcpy(&stReconfigParams.reInitEncodeParams, &m_stCreateEncodeParams, sizeof(m_stCreateEncodeParams));
	stReconfigParams.version = NV_ENC_RECONFIGURE_PARAMS_VER;		
	stReconfigParams.resetEncoder = 1;
	stReconfigParams.forceIDR = 1;
	stReconfigParams.reInitEncodeParams.frameRateNum = frameRate; // fps to 15

	nvStatus = m_pEncodeAPI->nvEncReconfigureEncoder(m_hEncoder, &stReconfigParams);
	if (nvStatus != NV_ENC_SUCCESS) {		
		return nvStatus;
	}

	return nvStatus;
}

Hi hmGo,

Could you provide us with the following information:

  1. Operating System
  2. driver version
  3. GPU being used
  4. Video Codec SDK version being used

Thanks,
Ryan Park

  1. Operating System
    : Windows 10 64 bit
  2. driver version
    : 391.01
  3. GPU being used
    : GeForce GTX 1070
  4. Video Codec SDK version being used
    : How to check the version number? But I got this nvenc sdk in around Nov. 2016.

Hi hmGo,

If you got the Video Codec SDK around November, chances are you are using the Video Codec SDK version 7.0.

Have you tried downloading the newest Video Codec SDK v8.1:

If this doesn’t work, then please follow up on this thread again.

Thanks,
Ryan Park