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;
}