Find frame rate from h265 NAL packets

2k views Asked by At

I have h265 NAL packets and need to determine the frame rate using them. I can do that if i use FFMPEG.

But for my application I cannot use ffmpeg and i need to determine the frame rate by analyzing the bit-stream (by C/C++). I did some research and found that it might be possible to use SPS headers for this. But i couldn't find out how to extract SPS headers and then fame rate.

Can some one tell me how to do this?

Thank you.

1

There are 1 answers

0
Ronald S. Bultje On

You're looking for the time_scale and num_units_in_tick elements in the VUI, which is located at the end of the SPS. The FPS is time_scale / num_units_in_tick. You can check decode_vui() in hevc_ps.c to see how to decode it exactly.

[edit] Oh and these same elements can be present in the VPS also; their values should be identical, but either one of them could be present alone, so you probably want to check both.