[x264-devel] VUI: 2 * num_units_in_tick / time_scale = frame_time

Tuukka Toivonen tuukkat at ee.oulu.fi
Tue Jul 19 21:02:12 CEST 2005


Hi, noticed this discussion in mp4tech list:

http://lists.mpegif.org/pipermail/mp4-tech/2005-July/005700.html

seems like x264 gets it wrong too. Not that I would understand
the standard, but I would trust Gary and the other folks there =)
(actually Gary's comment is not yet in the archives but he
seems to basically agree with John Cox)

Attached patch should fix this.

...

Also, seems like I can't specify NTSC frame rate exactly.

./x264 --frames 10 --fps 29.970
analyze: READ num_units_in_tick                        : [32] 1000
analyze: READ time_scale                               : [32] 59936
-> 29.968 fps

./x264 --frames 10 --fps 30000/1001
analyze: READ num_units_in_tick                        : [32] 1000
analyze: READ time_scale                               : [32] 60000
-> 30 fps

No patch for this latter "problem" this time.
-------------- next part --------------
Index: encoder/set.c
===================================================================
--- encoder/set.c	(revision 275)
+++ encoder/set.c	(working copy)
@@ -159,10 +159,10 @@
     if( param->i_fps_num > 0 && param->i_fps_den > 0)
     {
         sps->vui.b_timing_info_present = 1;
-        /* The standard is confusing me, but this seems to work best
-           with other encoders */
+        /* See the example in the NOTE near the end of D.2.2 in the standard and discussion
+         * thread at http://lists.mpegif.org/pipermail/mp4-tech/2005-July/005700.html. */
         sps->vui.i_num_units_in_tick = param->i_fps_den;
-        sps->vui.i_time_scale = param->i_fps_num;
+        sps->vui.i_time_scale = param->i_fps_num * 2;
         sps->vui.b_fixed_frame_rate = 1;
     }
     sps->b_vui |= sps->vui.b_timing_info_present;


More information about the x264-devel mailing list