Media Foundation Codec Error while trying H265 - succeeds in H.264

0

I 'm trying to encode video with Media Foudation.

The following code works when the codec is h.264:

// Setup output type
hr = pMediaTypeOutVideo->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
hr = pMediaTypeOutVideo->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_H264);
hr = pMediaTypeOutVideo->SetUINT32(MF_MT_AVG_BITRATE, 4000000);
hr = MFSetAttributeSize(pMediaTypeOutVideo, MF_MT_FRAME_SIZE, 1920,1080);
hr = MFSetAttributeRatio(pMediaTypeOutVideo, MF_MT_FRAME_RATE, 25, 1);
hr = MFSetAttributeRatio(pMediaTypeOutVideo, MF_MT_PIXEL_ASPECT_RATIO, 1,1);
hr = pMediaTypeOutVideo->SetUINT32(MF_MT_INTERLACE_MODE,MFVideoInterlace_Progressive);
hr = pSinkWriter->AddStream(pMediaTypeOutVideo, &OutVideoStreamIndex);

// Setup input type
hr = pMediaTypeVideoIn->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
hr = pMediaTypeVideoIn->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_NV12);
hr = MFSetAttributeSize(pMediaTypeVideoIn, MF_MT_FRAME_SIZE, 1920, 1080);
hr = MFSetAttributeRatio(pMediaTypeVideoIn, MF_MT_FRAME_RATE, 25, 1);
hr = MFSetAttributeRatio(pMediaTypeVideoIn, MF_MT_PIXEL_ASPECT_RATIO, 1, 1);
hr = pSinkWriter->SetInputMediaType(OutVideoStreamIndex, pMediaTypeVideoIn, NULL);

The last call succeeds only with MFVideoFormat_H264. With MFVideoFormat_HEVC, MFVideoFormat_VP80, MFVideoFormat_VP90, the last call fails with 0xc00d5212 : No suitable transform was found to encode or decode the content.

Do I miss some property in the h.265 or other encoders?

c++
winapi
video
ms-media-foundation
asked on Stack Overflow Nov 1, 2019 by Michael Chourdakis • edited Nov 1, 2019 by Roman R.

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0