Log in

View Full Version : about wmv's aspect ratio


tony2008
24th December 2007, 06:21
Now I use WMF to convert one file to wmv file,and I need to set the wmv file's aspect ratio.
I followed the SDK document and did like this:
1.I invokeed AddDataUnitExtension(WM_SampleExtensionGUID_PixelAspectRatio,WM_SampleExtension_PixelAspectRatio_Size,NULL,0);
2.set inputsettings:

COMRef<IServiceProvider> pSp;
COMRef<IWMWriterAdvanced2> pWMWA2;

hr = pWriterFilter->QueryInterface(IID_IServiceProvider,(void**)&pSp);
if ( FAILED(hr) )
{
return hr;
}

hr = pSp->QueryService(IID_IWMWriterAdvanced2,IID_IWMWriterAdvanced2,(void**)&pWMWA2);
if ( FAILED(hr) )
{
return hr;
}

BOOL value = TRUE;
hr = pWMWA2->SetInputSetting(1,g_wszInterlacedCoding,WMT_TYPE_BOOL,(const BYTE*)&value,sizeof(WMT_TYPE_BOOL));
if ( FAILED(hr) )
{
return hr;
}
3.at last,in the asf writer's callback function,I invoked the INSSBuffer3 and set the aspect ratio property.
But the resulting file,the aspect ratio is (width*aspectx)/(height*aspecty).
I don't know why,or it always been like this.
Does anybody know this?
thank you in advance.

tony2008
5th January 2008, 02:38
nobody knows it?

crypto
5th January 2008, 12:28
AFAIK, the decoder honors the data extensions and the AspectX/Y meta data. They should both tell the same aspect. Or you should only use one of them. I find the ApectX/Y method easier. I have written a tool (WMVARChanger (http://forum.doom9.org/showthread.php?t=116761&highlight=WMVARChanger)) that allows to modify it.