Hello,
I'm using sample mpeg2 directshow decoder filter from sdk 3.0 beta ( software decoding mode, never tried hardware mode) .
My problem happens with a video which has a resolution of 604x304.
Video Render filter (VR, VR9, EVR) shows video frames with an aspect similar to 4:3 but in fact should be similar to 16:9.
So after doing some debug at the decoder source code I found in CDecVideoFilter::RenewSampleParams method that VIDEOINFOHEADER2 is received with incorrect information, struct comes with dwPictAspectRatioX = 1 and dwPictAspectRatioy = 1 (but should be dwPictAspectRatioX = 2 and dwPictAspectRatioy = 1) and that produces the behavior explained above.
I need some help about what's happening, and detect where the values are wrong filled (linked library,??) of course I can override the values manually inside the method (which actually works ) but it's a patch that I would not like to do unless there is no other option.
I tried with a similar video (604x304) but encoded with h264 and it displays correctly with VIDEOINFOHEADER2 filled ok (dwPictAspectRatioX = 2 and dwPictAspectRatioy = 1) also others mpeg2 decoders ( like Microsoft DTV-DVD Video Decoder ) works ok.
Thanks in advance
Walter
Link Copied
Hi Folks,
I was able to replicate the behavior using Walters reported configuration and think I figured it out.
Both the MS and Intel filters get dwPictAspectRatioX = 1 and dwPictAspectRatioY = 1 from the Elecard PushDemuxer.
The MediaSDK filter uses these values to set the aspect ratio, while I think the Microsoft decoder calculates the aspect ratio from the rcSource->Right and rcSource->Bottom variables.
The MS docs are a bit confusing. From VideoInfoHeader2 desc: The picture aspect ratio is given by dwPictAspectRatioX and dwPicAspectRatioY. These specify the intended shape of the video when it is displayed. The pixel aspect ratio is calculated from the rcSource rectangle and the picture aspect ratio.
I think using this data you can change the Intel sample to align with the behavior you are expecting.
Hope this helps
-Eric
Hi Walter,
When the upstream filter initiates a connection, CDecVideoFilter::CheckInputType is called. This is the first time the Intel filter reads those values, and this is where Id recommend calculating the new aspect ratio.
-Eric
For more complete information about compiler optimizations, see our Optimization Notice.