Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all articles
Browse latest Browse all 1079

Obtaining display aspect ratio from AVI files

$
0
0

Hi, I am reading SD PAL sized avi files that are 4:3 and 16:9 display aspect ratio but am not able to read this from the file.

When I call MFGetAttributeRatio() with GUID MF_MT_PIXEL_ASPECT_RATIO this returns 1:1. The MFVideoFormat also contains 1:1 and the aspect ratio in VideoInfo2 is 5:4 for both 4:3 and 16:9. I understand that the aspect ratio in VideoInfo2 is the storage aspect ratio and that I need the pixel aspect ratio and by multiplying this with the storage aspect ratio this then gives the display aspect ratio but I have not been successful in reading this value. Also the interlaced field is always progressive which is incorrect, it should be interlaced.

Analysing the output from MFTrace when attached to windows media player on Windows 7 I can see that the MF_MT_PIXEL_ASPECT_RATIO value on calls to setInputType and setOutputType will change from 1,1 to 16,15 and then 64,45, the latter when multiplied with 5:4 gives 16:9.

I have started using media foundation and have read the article: http://msdn.microsoft.com/en-us/library/bb530115(v=VS.85).aspx

but this does not explain how I obtain the source display aspect ratio I am after.

Any suggestions and help much appreciated as I think I am not the only person who is struggling with this. To give a little more information I am using Media Foundation to import AVI files into our editor software and I can read all other video information such as size and frame rate but need to know the interlace mode and display aspect ratio before reading the samples into our application.


Viewing all articles
Browse latest Browse all 1079

Trending Articles