I'm writing a program using H.264 encoder MFT to do video encoding.
The way I'm using to select/create the encoder is like:
MFT_REGISTER_TYPE_INFO encoderInfo;
encoderInfo.guidMajorType = MFMediaType_Video;
encoderInfo.guidSubtype = MFVideoFormat_H264;
// H.264 Encoder class id is not exposed, so we have to enumerate
HRESULT hr = MFTEnum(MFT_CATEGORY_VIDEO_ENCODER, 0, NULL, &encoderInfo, NULL, &pCLSIDs, &nCount);
if (nCount == 0) {
break;
}
//Create H.264 Encoder MFT instance
ciEncoder.CreateObject(pCLSIDs[0], IID_IMFTransform);
Now on my machine the nCount will be set to 1 after MFTEnum is called. I just want to know, if there's a certified hardware encoder available on my machine, will nCount be set to 2? and then I'll be able to select the one I want?
Another question is, I'm using the synchronous processing mode to encode frames as described in
https://msdn.microsoft.com/en-us/library/windows/desktop/aa965264(v=vs.85).aspx#create_mft
If I could enum and select a hardware encoder MFT, may I use the same code logic to do the encoding?
Great thanks
did you check this flag : MFT_ENUM_FLAG_HARDWARE
You need to use : MFTEnumEx
Because hardware encoder should process asynchronously, you will need to change the logic from the MSDN example.