Error "NV_ENC_ERR_INVALID_VERSION" when using nvenc encoder

I am using cuda nvenc encoder to encode a YUV frame. I want to stream h264 encoded data using RTSP streaming. I need an SPSPPS buffer for an RTSP stream. I am using "nvEncGetSequenceParams" to get spspps buffer. I called this function after calling the "nvEncInitializeEncoder" function as expected. I am getting the error "NV_ENC_ERR_INVALID_VERSION" which means that I am passing the wrong structure to this function. but i checked several times that i got it right. I think it might be a driver version issue. I have a Quadro k5000 GPU. I tried this on driver versions 331.82 and 337.88. Below 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;
}

      

+3


source to share


1 answer


You are installing the wrong version macro in the SPS / PPS structure. I don't have my NVIDIA code by hand, so I'll try Google the correct macro, but the rule of thumb is that each structure has a specific macro version (for example, you use NV_ENC_INITIALIZE_PARAMS for an SPS / PPS structure, which is definitely not the case. I assume that the type m_spspps

is NV_ENC_SEQUENCE_PARAM_PAYLOAD

. Therefore, you must initialize it like this:



 m_spspps.version = NV_ENC_SEQUENCE_PARAM_PAYLOAD_VER;

      

+1


source







All Articles