[x264-devel] commit: write aspect ratio in mp4 (vmrsss )

git version control git at videolan.org
Sat May 17 08:57:03 CEST 2008


x264 | branch: master | vmrsss <vmrsss at gmail.com> | Sat May 17 00:50:22 2008 -0600| [e11ef38d38d4c83c1788b9be53021239133e348f]

write aspect ratio in mp4

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=e11ef38d38d4c83c1788b9be53021239133e348f
---

 muxers.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/muxers.c b/muxers.c
index 770bb4c..41b8e7d 100644
--- a/muxers.c
+++ b/muxers.c
@@ -676,6 +676,18 @@ int set_param_mp4( hnd_t handle, x264_param_t *p_param )
     gf_isom_set_visual_info(p_mp4->p_file, p_mp4->i_track, p_mp4->i_descidx,
         p_param->i_width, p_param->i_height);
 
+    if( p_param->vui.i_sar_width && p_param->vui.i_sar_height )
+    {
+        uint64_t dw = p_param->i_width << 16;
+        uint64_t dh = p_param->i_height << 16;
+        double sar = (double)p_param->vui.i_sar_width / p_param->vui.i_sar_height;
+        if( sar > 1.0 )
+            dw *= sar ;
+        else
+            dh /= sar;
+        gf_isom_set_track_layout_info( p_mp4->p_file, p_mp4->i_track, dw, dh, 0, 0, 0 );
+    }
+
     p_mp4->p_sample->data = (char *)malloc(p_param->i_width * p_param->i_height * 3 / 2);
     if (p_mp4->p_sample->data == NULL)
         return -1;



More information about the x264-devel mailing list