I try to do motion estimation every frame.
But nvEncRunMotionEstimationOnly throw exception after after call.
You can reproduce this below codes.
NVENCSTATUS nvStatus;
// first motion estimation call works well
nvStatus = m_pEncodeAPI->nvEncRunMotionEstimationOnly(m_hEncoder, &m_stMEOnlyParams);
if (nvStatus != NV_ENC_SUCCESS)
{
printf(“nvEncRunMotionEstimationOnly failed”);
return nvStatus;
}
WaitForSingleObject(mOutputBuffer.hOutputEvent, INFINITE);// wait for complete
// second motion estimation
nvStatus = m_pEncodeAPI->nvEncRunMotionEstimationOnly(m_hEncoder, &m_stMEOnlyParams);// throw exception here
if (nvStatus != NV_ENC_SUCCESS)// nvStatus is NV_ENC_ERR_INVALID_PARAM
{
printf(“nvEncRunMotionEstimationOnly failed”);
return nvStatus;
}