• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2240
  • Last Modified:

Help Me Understand AVI Files and Aspect Ratio

I'm having a hell of a time understanding aspect ratios as they apply to AVI formatted video files for a video editing application.

(1) Are the "aspect ratios" reported by Windows Media Player (File>Properties) the pixel aspect ratio (PAR) or the display aspect ratio (DAR)?

(2) Are the "aspect ratios" reported by Windows Media Player a field in all AVI files, or only present in some AVI files, specific to the codec, etc.?

(3) How can I edit/set the aspect ratio in an AVI file, using a tool like VirtualDub?
  • 3
  • 2
1 Solution
todd_e_bryantAuthor Commented:
LHerrou, thanks for reposting in a more appropriate location.
Pixel aspect ration is not displayed by players usually, since it is a standard for different media. Computer monitors has a 1/1 PAR, but in TV, VCD, DVD the PAR is different from square, look here for some details: http://www.mir.com/DMG/aspect.html
1. Windows Media Player displays the DAR in pixels and as a ratio.
2. The avi main header contain two variables, dwWidth and dwHeight, the width and height in pixels. The codec used doesn't matter, avi is a container, not a codec.
3. Reencoding, but with a lot of comments about PAR and DAR. Read here: http://www.animemusicvideos.org/guides/avtech/aspectratios.html#mozTocId829564
todd_e_bryantAuthor Commented:
The reference table at the end of the mir.com document is a great reference.

Crissand's comment almost got the answer I'm searchign for, but I find myself still confused about how AVI and apps handle aspect ratio.  Let me me precise.  Consider these two cases:

(a) I create a 720x480 uncompressed AVI file
(b) I create a 720x480 DV-coded AVI file

As I understand it, in both cases, there are actually 720x480 pixels of information in the AVI file.  But if you look at the files with Windows Media Player, it will say the aspect ratio of the file (a) is 3:2 (square pixel ratio of 720:480), but it will say the aspect ratio of the file (b) is 4:3 (narrow pixel ratio of 10:11).  Windows Media Player then scales the second AVI file horizontally automatically, so it looks 640x480 on my monitor.

To summarize:

(a) Windows Media Player says 720x480, 3:2 aspect ratio (WMP displays as 720x480 on my square pixel monitor)
(b) Windows Media Player says 720x480, 4:3 aspect ratio (WMP displays as 640x480 on my square pixel monitor)

So, Windows Media Player treats the source pixel aspect ratio of the two files differently.  It seems Windows Media Player must get the source pixel aspect ratio for the file from somewhere, either in the AVI headers, or perhaps from the fact it's a DV codec, or the codec metadata.  This is the piece I'm missing.

In particular... is this a general feature?  Can I create an AVI file and specify arbitrary non-square source pixels, or is this just a special case for DV?
Yes, the aspect ratio is in the header of opendml avi. Somehow I forgot about the new avi format, open dml, that extend the original definition of Microsoft avi container. More info are in this file, if it's available: http://www.the-labs.com/Video/odmlff2-avidef.pdf.
But, the aspect ratio depends of the codec used. XVid, the free and excellent mpeg4 implementation, has a dialog tab for setting aspect ratio, but with the warning that it can be ignored when decoding.

Mpeg2 have the aspect ratio in the video sequence header, but the standard state that the decoding process can ignore it. Read about mpeg2 AR here, to better understand the problem: http://www.geocities.com/eby_vdo/

My recommendation: If the task is to recode existing video, keep the PAR. If you do your own video, use square pixels, if possible.
todd_e_bryantAuthor Commented:
I'm accepting crissand's answer... it provides background to most of my questions.  I'm still not 100% sure how I can set the PAR in an AVI file, but I have a general understanding what's going on.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now