本文介绍了H264编码器问题(窗口10)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hr = MFCreateMediaType(&mediaTypeIn);
hr = mediaTypeIn->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
hr = mediaTypeIn->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_AYUV);
hr = mediaTypeIn->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive);
hr = MFSetAttributeSize(mediaTypeIn, MF_MT_FRAME_SIZE, width, height);
hr = MFSetAttributeRatio(mediaTypeIn, MF_MT_FRAME_RATE, fps_num, fps_den);
hr = MFSetAttributeRatio(mediaTypeIn, MF_MT_PIXEL_ASPECT_RATIO, 1, 1);
hr = MFCreateMediaType(&mediaTypeOut);
hr = mediaTypeOut->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
hr = mediaTypeOut->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_H264);
hr = mediaTypeOut->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive);
hr = mediaTypeOut->SetUINT32(MF_MT_AVG_BITRATE, bit_rate);
hr = mediaTypeOut->SetUINT32(MF_MT_MPEG2_PROFILE, eAVEncH264VProfile_Main)
hr = MFSetAttributeSize(mediaTypeOut, MF_MT_FRAME_SIZE, width, height);
hr = MFSetAttributeRatio(mediaTypeOut, MF_MT_FRAME_RATE, fps_num, fps_den);
hr = MFSetAttributeRatio(mediaTypeOut, MF_MT_PIXEL_ASPECT_RATIO, 1, 1);
hr = vx->sinkWriter->AddStream(mediaTypeOut, &vx->streamIndex);
hr = vx->sinkWriter->SetInputMediaType(vx->streamIndex, mediaTypeIn, NULL);
SetInputMediaTyp()失败并返回错误'MF_E_INVALIDMEDIATYPE'
我尝试过:
此代码可以使用在Windows 7中很好,在Windows 10中失败。
SetInputMediaType()失败并返回MF_E_INVALIDMEDIATYPE?
如果是VBR('eAVEncCommonRateControlMode_Quality'),则需要MF_MT_AVG_BITRATE'值?
SetInputMediaTyp () failed and returns with error 'MF_E_INVALIDMEDIATYPE'
What I have tried:
This code works fine in windows 7 and failed in windows 10.
SetInputMediaType() failed and returns MF_E_INVALIDMEDIATYPE?
In case of VBR ('eAVEncCommonRateControlMode_Quality'), MF_MT_AVG_BITRATE' value is required?
推荐答案
这篇关于H264编码器问题(窗口10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!