Log in

View Full Version : MP4 Aspect ratio


lcx
3rd February 2007, 00:48
I recently encoded a video file using x264 with SAR set to 16:9.
After encoding was complete, I found that the aspect ratio is incorretly displayed as 20:9
I can't find any reference for the MP4 file format so I can't figure out where in the header the aspect ratio is stored.

I am not sure if this is a GPAC bug or just something wrong with the players (media player classic / VideoLan)

Any pointers to the file format?
Or hints where to look for the aspect ratio in the file.

foxyshadis
3rd February 2007, 02:01
You can always use mp4box to remux it correctly, that way you don't have to muck around with a hex editor. YAMB is a good gui to mp4box, if you need one.

lcx
3rd February 2007, 03:28
Thanks. I ran mp4box with the following options:
mp4box -add Video.mp4 -par 1=16:9 VideoOut.mp4

The output video is just a blank video. :(
Note: there is no audio.

bkman
3rd February 2007, 04:25
The SAR/PAR is not the same as the Display AR, so your usage of MP4box is incorrect.

Simply put, the PAR is the factor that you would need to multiply the horizontal dimension by to get the AR that you want. For example if you want a 720x480 clip to be displayed at 16:9, you would define a par of 32:27.

Oh, and the simple way to change the AR of an MP4 is just

mp4box -par 1=32:27 VideoIn.mp4

lcx
3rd February 2007, 05:17
Thanks.
Anyway, I put a breakpoint in x264 in a test encoding process and figured out where the ratio is written and hex-edited my original file to resolve my issue.