Reputation: 919
I am using the cuda nvenc encoder to encode an YUV frame. I want to stream the encoded h264 data using RTSP streaming. I need the SPSPPS buffer to do RTSP stream. I am using "nvEncGetSequenceParams" to get the spspps buffer. I have called this function after calling the "nvEncInitializeEncoder" function as expected. I am getting the "NV_ENC_ERR_INVALID_VERSION" error which means I am passing wrong struct to this function. but I have checked multiple times the struct I have passed is correct. I think this can be driver version problem. I have Quadro k5000 GPU. I have tried this on driver version 331.82 and 337.88. Following is the code I am using.
NVENCSTATUS CNvEncoderH264::GetSPSPPSBUffer(char *SPSPPSBuffer)
{
NVENCSTATUS nvSta = NV_ENC_SUCCESS;
uint32_t size = 0;
//m_spspps is of type NV_ENC_SEQUENCE_PARAM_PAYLOAD
m_spspps.inBufferSize = 512;
m_spspps.outSPSPPSPayloadSize = &size;
SET_VER(m_spspps, NV_ENC_INITIALIZE_PARAMS);
m_spspps.spsppsBuffer = SPSPPSBuffer;
nvSta = m_pEncodeAPI->nvEncGetSequenceParams(m_hEncoder,&m_spspps);
return nvSta;
}
Upvotes: 3
Views: 4005
Reputation: 11954
You are setting the wrong version macro to the SPS/PPS structure. I don't have my NVIDIA code by hand, so I'll try to Google the right macro but rule of the thumb is that each structure has a specific version macro (ans you are using NV_ENC_INITIALIZE_PARAMS for the SPS/PPS structure which is definitely not right. I assume the type of m_spspps
is NV_ENC_SEQUENCE_PARAM_PAYLOAD
. So you should initialize it like this:
m_spspps.version = NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER;
Upvotes: 2