NV Encoder presentation timestamps

Hello, I’m currently implementing a camera recorder using the code base in:

Into “.h264” files.

I successfully manage to encode videos in impressive speeds but the issue I find is that presentation time stamps are not included in the final result despite me adding them in the “inputTimeStamp” field under the NV_ENC_PIC_PARAMS parameter. Looking online it seems that “.h264” files do not support presentation time stamp.

My question is whether I’m missing a method/variable to write timestamps into the video, or a way to use the Nvidia encoder to directly encode into a type that does contain presentation timestamps (ie, MP4).


Looking at the NVENC API Programming Guide:

"Codec-agnostic parameters such as timestamp, duration, input buffer pointer, etc. are passed via the structure NV_ENC_PIC_PARAMS while codec-specific parameters are passed via the structure NV_ENC_PIC_PARAMS_H264/NV_ENC_PIC_PARAMS_HEVC/NV_ENC_PIC_PARAMS_AV1 depending upon the codec in use. "

Ref NV_ENC_PIC_PARAMS here - inputTimeStamp

It might be due to opening the resulting .h264 file with opencv, but the presentation time variable I set in each frame NV_ENC_PIC_PARAMS does not appear when I try to get the frame information from the VideoCapture.