Adding timestamp thru NV_ENC_PIC_PARAMS when encoding via Video CODEC SDK: timestamp data is not seen

OS: Ubuntu 20.04 LTS
SDK: NVIDIA Video CODEC SDK 12
GOAL: H.264 and HEVC encoding
SAMPLE: AppEncCuda
I’m working on encoding frames grabbed from a high resolution camera. The encoding is working for both H.264 and HEVC.

I’d like to add timestamp (PTS) into the encoded video. I have the timestamp for each frame. I used NV_ENC_PIC_PARAMS::inputTimeStamp as an input parameter. However, I don’t think the timestamp data is successfully added thru encoding since if I use ffprobe against the encoded video, both start_timestamp and start_pts are N/A. For example, using this command: ffprobe -show_format -show_streams file.hevc

As far as code, we can just base it on the sample AppEncCuda, by expanding it a bit by adding additional input parameter - NV_ENC_PIC_PARAMS.

  1. I believe adding timestamp is supported by Video CODEC SDK 12 as its doc indicates. Am I right?
  2. Any additional step should I take to add timestamp in the encoding?
  3. Any suggestion on how to determine/verify that timestamp is added?

Thanks for your help!
William

1 Like