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

SetOutputType failed because of resolution

$
0
0

Hi,

I'm using H.264 encoder MFT to do video encoding in my program. Everything works correctly until I found a file on which the H.264 encoder couldn't set output type successfully.

The code I used to set up encoder is here

ciEncoder.CreateObject(pCLSIDs[0], IID_IMFTransform);
// H.264 Encoder MFT needs to set output first 
LComObject<IMFMediaType> ciOutputType;  // Output media type of the encoder
hr = fpMFCreateMediaType((IMFMediaType**)(ciOutputType.GetAssignablePtrRef()));
hr = ciOutputType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
hr = ciOutputType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_H264);
hr = ciOutputType->SetUINT32(MF_MT_AVG_BITRATE, 768 * 1000);
hr = ciOutputType->SetUINT32(MF_MT_INTERLACE_MODE, 2);
hr = ciOutputType->SetUINT32(MF_MT_MPEG2_PROFILE, eAVEncH264VProfile_Base);
hr = MFSetAttributeRatio(ciOutputType.get(), MF_MT_FRAME_RATE, 10, 1);
hr = MFSetAttributeSize(ciOutputType.get(), MF_MT_FRAME_SIZE, vf.iWidth, vf.iHeight);
hr = MFSetAttributeRatio(ciOutputType.get(), MF_MT_PIXEL_ASPECT_RATIO, 1, 1);
hr = ciEncoder->SetOutputType(0, ciOutputType.get(), 0);

The input video (an swf video) resolution is 76x12 and with above code SetOutputType returns MF_E_INVALIDMEDIATYPE.

If I keep width 76 but change height to 70 for example, then SetOutputType can succeed. I also tried other values like 24, 38 but both failed.

Could anyone help to check this?

Thanks



Viewing all articles
Browse latest Browse all 1079

Trending Articles