How to get Pixel Aspect Ratio(PAR) from WMV clip in DShow Graph?

332 views Asked by At

By the wiki for Pixel Aspect Ratio:

DAR = SAR x PAR 
(Display Aspect Ratio, Storage Aspect Ratio, Pixel Aspect Ratio)

I have a wmv video with 2048x1080(256:135) resolution. Window Media Player (WMP) can extract the PAR, 15:16, so that WMP can render this clip as 16:9(= 256:135 * 15:16).

Currently I can only get dwPictAspectRatioX/dwPictAspectRatioY from VIDEOINFOHEADER2 as 256/135. This value looks like a SAR by the resolution or the DAR ignore the PAR.

How can I get the PAR information from DShow graph?

p.s I'm using [ASF Reader]-[DMO]-[VMR7] as filter components in Graph.

PotPlayer cannot read the PAR either, so that it renders this clip with aspect ratio 256:135 instead of 16:9.

Updated,

I found out that ASF_Reader_Filter::IWMHeaderInfo::GetAttributeByName::Atrributes.

There is a attribute AspectRatio X (Y) with the following meaning:

The AspectRatioX attribute contains the width component of the pixel aspect ratio for a video stream.

I am trying to queryInterface or queryService via IServiceProvider from ASF reader filter, but it always return E_NOINTERFACE.

Still need more investigation.

1

There are 1 answers

0
Roman Ryltsov On

VIDEOINFOHEADER2::dwPictAspectRatio gets you ratio, which is adjustment for non-square pixels in the encoded image. That is, if you enforce dwPictAspectRatio when you present video and you assume that monitor itself has square pixels, you get proper physical aspect ratio.

By contrast, a 720 × 576 D-1 PAL image has a SAR of 720/576 = 5:4, but is displayed on a 4:3 display (DAR = 4:3).

  • biWidth, biHeight, rcSource have pixel dimension values (720x576) - SAR
  • dwPictAspectRatio instructs to show 4:3 - DAR