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

Failed to set VBR quality on WMV MFT encoder.

$
0
0

Hi, I'm using Windows Media Foundation WMV encoder on Win10 64bit. While it can be used to encode correctly, I failed to set VBR quality.

Below is the sample code

const PROPERTYKEY MFPKEY_VBRENABLED = { { 0xe48d9459, 0x6abe, 0x4eb5, { 0x92, 0x11, 0x60, 0x8, 0xc, 0x1a, 0xb9, 0x84 } }, 0x14 };     
const PROPERTYKEY MFPKEY_DESIRED_VBRQUALITY = { { 0x6dbdf03b, 0xb05c, 0x4a03, { 0x8e, 0xc1, 0xbb, 0xe6, 0x3d, 0xb1, 0x0c, 0xb4 } }, 0x00 + 25 };	  	  

CLSID* pCLSIDs = NULL;   // Pointer to an array of CLISDs.   UINT32 nCount = 0;     
MFT_REGISTER_TYPE_INFO encoderInfo;      encoderInfo.guidMajorType = MFMediaType_Video; 
encoderInfo.guidSubtype = MFVideoFormat_WMV3;     
HRESULT hr = fpMFTEnum(MFT_CATEGORY_VIDEO_ENCODER, 0, NULL, &encoderInfo, NULL, &pCLSIDs, &nCount);     
if (FAILED(hr) || (nCount == 0)) {}            ciEncoder.CreateObject(pCLSIDs[0], IID_IMFTransform);     
if (ciEncoder.IsInvalid()) {}          
LComInterface<IPropertyStore> ciPropertyStore; // WMV Encoder codec setting interface     
hr = ciEncoder->QueryInterface(IID_IPropertyStore, (void**)ciPropertyStore.GetAssignablePtrRef());    
if (SUCCEEDED(hr)) {         
    PROPVARIANT  propVal;         
    propVal.vt = VT_BOOL;         
    propVal.boolVal = VARIANT_TRUE;                  
    hr = ciPropertyStore->SetValue(MFPKEY_VBRENABLED, propVal);                 
    propVal.vt = VT_UI4;         
    propVal.ulVal = 90;         
    hr = ciPropertyStore->SetValue(MFPKEY_DESIRED_VBRQUALITY, propVal);         


While ciPropertyStore->SetValue(MFPKEY_VBRENABLED, propVal) returns S_OK, ciPropertyStore->SetValue(MFPKEY_DESIRED_VBRQUALITY, propVal) failed and hr = "The property ID does not match any property supported by the transform"

Thanks

== Update ==================================

if I run it on WMA encoder

 ciEncoder.CreateObject(CLSID_CWMAEncMediaObject1, IID_IMFTransform);

then there's no error. 




Viewing all articles
Browse latest Browse all 1079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>