MattHawkins
MattHawkins

MPEG Header Aspect Ratio, Resolution and Frame Rate  

by Matt Hawkins, 08/01/2012
Categories : Video Editing

The following information explains how aspect ratio, resolution and frame rate is recorded in the header of a DVD compliant MPEG2 video file.

This allows you to tweak the values in a hex editor if required. Changing the resolution and frame rate values does not change the data in the video ... so changing these values isn't very useful. However, I have often needed to correct an inaccurate aspect ratio in DVD sourced mpg files.

To find the values in your video file load it into a HEX editor. Locate the sequence header which will begin with 00 00 01 b3. This is usually hex address 000 but can be further into the file so you may need to search for it.

Here is an example :

00 00 01 B3 2D 02 40 23 00 00 00 00 00 00 00 00

mpeg_header_hex_editor.png


Breaking this down gives us :

00 00 01 B3 - Start of header

2D 0 - 720 horizontal resolution
2 40 - 576 vertical resolution
2 - 4:3 aspect ratio
3 - 25 frames per second

This means our example video is 720x576, 4:3, 25 fps.

Here are some additional numbers for common MPEG2 video parameters.

Horizontal Size (Hex)
======================
160 = 352 pixels
1E0 = 480 pixels
2D0 = 720 pixels
2E4 = 740 pixels

Vertical Size (Hex)
======================
0F0 = 240 pixels
1E0 = 480 pixels
240 = 576 pixels

Aspect Ratio
======================
1 = 1:1
2 = 4:3
3 = 16:9
4 = 2.211

Frame Rate (fps)
======================
1 = 23.976
2 = 24
3 = 25
4 = 29.97
5 = 30
6 = 50
7 = 59.94
8 = 60

It's fairly simply once you know how. The bad news is that the video file may contain multiple sequence headers and changing them all by hand would be impossible.

The good news is that I've created a tool (Windows only) to do this job for you automatically. I will post details when it is ready.

Note : The above screen shot was taken from Frhed, a free hex editor available from PortableApps.com.

Author : Matt Hawkins  Last Edit By : Matt Hawkins
PHP Powered  MySQL Powered  Valid XHTML 1.0  Valid CSS  Firefox - Take Back The Web  EUKHost - Recommended Webhosting Solutions

MattHawkins CMS v3.0 - Copyright 1993-2017