Nvidia Video Codec SDK 7.0 HEVC custom SEI support problem

I tried to put custom SEI message during the HEVC encoding without success, but for H264 it works.

I modified NvEncoder sources (from samples):
for HEVC I added in CNvHWEncoder::NvEncEncodeFrame:
encPicParams.codecPicParams.hevcPicParams.seiPayloadArray = sei_payload;
encPicParams.codecPicParams.hevcPicParams.seiPayloadArrayCnt = 1;

and for H264:
encPicParams.codecPicParams.h264PicParams.seiPayloadArray = sei_payload;
encPicParams.codecPicParams.h264PicParams.seiPayloadArrayCnt = 1;

sei_paylod the same in both cases.

We just tried this internally and it worked fine. Can you please check with the latest drivers and SDK 7.1? If it still reproduces, please provide the following additional information for us to help further:

  1. Driver version
  2. SDK version
  3. Application you are using
  4. Exact sequence of steps (with source code) in the application
  5. Preferably, please share an application which reproduces the problem

Thank you for your help.

Dear NVIDIA expert,

I’ve reproduce the owner’s issue with Video_Codec_SDK_7.1.9, below is details:
1. Driver version
Driver Version: 375.39
2. SDK version
Video_Codec_SDK_7.1.9
3. Application you are using
Based on NvEncoder in Video_Codec_SDK_7.1.9 sample code. The only changed file is: Video_Codec_SDK_7.1.9/Samples/common/src/NvHWEncoder.cpp
Please download here, or just copy the code below and put it in the sample code common/src/NvHWEncoder.cpp.
All sample code: http://pan.baidu.com/s/1bpMVjND
Modified file ‘common/src/NvHWEncoder.cpp’ NvHWEncoder.cpp_免费高速下载|百度网盘-分享无限制
4. Exact sequence of steps (with source code) in the application
The test is based on sample code NvEncoder. I’ve add the code below in NvHWEncoder.cpp, in function NvEncEncodeFrame() before nvEncEncodePicture() is called.

#if 1 //add sei
    printf("try to add sei with payloadType 5\n");
#define USER_DATA_SIZE 100

    NV_ENC_SEI_PAYLOAD *psei_payload = (NV_ENC_SEI_PAYLOAD *)malloc (sizeof (NV_ENC_SEI_PAYLOAD));
    uint8_t *psei_data = (uint8_t *)malloc (USER_DATA_SIZE);
    for (int i=0;i<USER_DATA_SIZE;i++)
    {
        psei_data[i] = (i+100) & 0xff;
    }

    psei_payload->payloadSize = USER_DATA_SIZE;
    psei_payload->payloadType = 5;
    psei_payload->payload = psei_data;

    if (codecGUID != NV_ENC_CODEC_HEVC_GUID)
    {
        encPicParams.codecPicParams.h264PicParams.seiPayloadArray = psei_payload;
        encPicParams.codecPicParams.h264PicParams.seiPayloadArrayCnt = 1;
        printf("set for h264\n");
    }
    else
    {
        encPicParams.codecPicParams.hevcPicParams.seiPayloadArray = psei_payload;
        encPicParams.codecPicParams.hevcPicParams.seiPayloadArrayCnt = 1;
        printf("set for hevc\n");
    }
#endif

Just hard code to test the issue, undefine the ‘#if 1’ for none SEI encoding and compare the output streams. Looks like it works only for h264, not for hevc. The encoded hevc stream has nothing changed.

My command is:
./NvEncoder -i in_3840x2160.yuv -size 3840 2160 -inputFormat 0 -codec 1 -o tmp1.hevc

I’ve created another topic a few days before, I think it is duplicated.

Thanks for your help.