Understanding H.264 num_units_in_tick and time_scale

View Full Version : Understanding H.264 num_units_in_tick and time_scale

sameersbn
25th February 2010, 21:09
Hi,
I have been trying to understand the various fields in the SPS Unit of H.264 stream.
I have a h.264 bitstream that is plays at 25 fps. Looking at the bitstream the VUI information in the SPS unit has
num_units_in_tick = 1000
time_scale = 50000

I am failing to understand how the fps is calculated using these two values.
I can arrive at 25 value using:

fps = time_scale / num_units_in_tick / 2
= 50000 / 1000 / 2
= 25

Looking at the patch attached in this post http://osdir.com/ml/video.x264.devel/2005-07/msg00054.html, it seems thats x264 does it in the same (not sure whether the patch was accepted or not)

Is this actually how its supposed to be? Or is there some way a divisor is to be calculated or something of that sort.

Also can you please tell me which bit field indicates whether the video stream is in field mode or frame mode.

In the mean time i will keep looking on the internet.

Thanks and Regards
~Sameer
neuron2
25th February 2010, 22:04
It's all documented in the AVC specifications, which are readily available.
Shevach
28th February 2010, 17:00
In the H.264 standard the notion of the ratio 'num_units_in_tic/time_scale'
depends on nuit_field_based_flag.

If nuit_field_based_flag=1 then the the above ratio denotes field rate otherwise it denotes frame rate.

Apparently in x.264 nuit_field_based_flag is set to 1 therefore the ratio num_units_in_tic/time_scale is further divided by 2 in order to get frame rate.

你可能感兴趣的:(Understanding H.264 num_units_in_tick and time_scale)