Multimedia API encoded H265-file seems corrupted

I’m using the Multimedia API to create an h265-encoded video file. I mostly follow the samples coming with the API, with some specifics for our project (converting a bgr8 ROS image message to yuv444 before sending it to the encoder).
The generated file looks fine to my eye, it plays just nicely in the Ubuntu video player. What concerns me is that the generated file doesn’t seem to have proper information about the FPS and the play length. I explicitly set the FPS to 30 in code, but the file reports 25. It plays for roughly 7s, but reports a length of 0s in the file properties, and I cannot scrub it in the player.
When I inspect the file through opencv (opening itwith a cv::VideoCapture) and request the number of frames, I get an invalid value (reports back -2147483648 frames), so I assume it can’t find the information.

I read here: NVIDIA Multimedia APIs with UYVY sensor that h264 doesn’t have any framerate information in the file. Is the same true for h265? I couldn’t find any information about it. Also, how am I supposed to handle this? Do I have to put it into some kind of container?
As far as I understood, there is no manual header or trailer creation needed. If this is right and out of curiosity, how is the file length then retrieved by a video player? I kinda suspect that what I see is expected behavior and that I am missing a step in making a properly setup video file (again, using a container maybe? Muxing?).

Additional information: When I encode as h264, I get roughly the same results, with the difference that the file gets played back in the video player at a crazy speed, like it’s done in a fraction of a second. Again, I suspect it to be related to missing FPS information.

Thanks for your help,

Please refer to the commands and give it a try:

The prebuilt lib is for r32.1. Suppose you use a newer release and shall not need it.

Hi @DaneLLL,
thanks for the answer. Inserting sps, pps & vui helped solve the broken FPS information. I can now scrub the file in the player and the file properties show me a valid playback length. I still don’t get valid numbers for the frame count in the file, though. Also the file’s bitrate isn’t properly displayed. This isn’t breaking my neck right now, but I’d be curious to know why I would be seeing this.

Best regards,

We don’t have experience of using the OpenCV function. Would need your help to share a simple code(python or C) to show that frame count and bitrate are invalid. Also if you have h265 stream that frame count and bitrate can be got correctly, please share it forour reference.