问题
I'm using the video processor MFT for pixel format conversion. That works fine. But when I change the input size and keep the output the same the processing of the input
hr = ColorConv->ProcessInput(0, pSample, 0);
fails with:
The data specified for the media type is invalid, inconsistent, or not supported by this object.
I think I need to make some settings for the video resizer but I can't figure out the minimal conditioins. What I read is that I need to set SetFullCropRegion but that does not exist in MFT (is DMO)? Also setting SetConstrictionSize does not work.
What I have now is.
IMFTransform* ColorConv;
...
UINT32 unFlags = MFT_ENUM_FLAG_SYNCMFT |
MFT_ENUM_FLAG_SYNCMFT |
MFT_ENUM_FLAG_HARDWARE |
MFT_ENUM_FLAG_LOCALMFT |
MFT_ENUM_FLAG_SORTANDFILTER;
IMFActivate **ppMFTActive;
UINT32 cMFTActive;
hr = MFTEnumEx(MFT_CATEGORY_VIDEO_PROCESSOR, unFlags, nullptr, nullptr, &ppMFTActive, &cMFTActive);
...
ppMFTActive[0]->ActivateObject(__uuidof(IMFTransform), (void **)&ColorConv);
...
// input:
pMFTInputMediaType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
pMFTInputMediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_YUY2);
hr = MFSetAttributeSize(pMFTInputMediaType, MF_MT_FRAME_SIZE, 320, 240);
...
hr = ColorConv->SetInputType(0, pMFTInputMediaType, 0);
// output
pMFTOutputMediaType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
pMFTOutputMediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB24);
hr = MFSetAttributeSize(pMFTOutputMediaType, MF_MT_FRAME_SIZE, 352, 288);
...
hr = ColorConv->SetOutputType(0, pMFTOutputMediaType, 0);
来源:https://stackoverflow.com/questions/32481417/video-resizing-with-the-video-processor-mft