I'm encoding video using Windows Media Foundation, but i've had an issue with hardware encoding using AMDh264Enc. The video comes out all washed out, so there is obviously an issue with the color range. The video source is screen capture from Desktop Duplication, which is in R8G8B8A8 (32 bit ARGB) format.
// Set the output video type.
MFCreateMediaType(&pVideoMediaTypeOut));
pVideoMediaTypeOut->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video); pVideoMediaTypeOut->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_H264); pVideoMediaTypeOut->SetUINT32(MF_MT_AVG_BITRATE, m_VideoBitrate); pVideoMediaTypeOut->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive); pVideoMediaTypeOut->SetUINT32(MF_MT_MPEG2_PROFILE, eAVEncH264VProfile_High)); MFSetAttributeSize(pVideoMediaTypeOut, MF_MT_FRAME_SIZE, destWidth, destHeight); MFSetAttributeRatio(pVideoMediaTypeOut, MF_MT_FRAME_RATE, m_VideoFps, 1); MFSetAttributeRatio(pVideoMediaTypeOut, MF_MT_PIXEL_ASPECT_RATIO, 1, 1);
// Set the input video type.
MFCreateMediaType(&pVideoMediaTypeIn));
pVideoMediaTypeIn->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
pVideoMediaTypeIn->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_ARGB32);
pVideoMediaTypeIn->SetUINT32(MF_MT_VIDEO_NOMINAL_RANGE, MFNominalRange_Normal);
pVideoMediaTypeIn->SetUINT32(MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive);
MFSetAttributeSize(pVideoMediaTypeIn, MF_MT_FRAME_SIZE, sourceWidth, sourceHeight);
MFSetAttributeRatio(pVideoMediaTypeIn, MF_MT_FRAME_RATE, m_VideoFps, 1);
MFSetAttributeRatio(pVideoMediaTypeIn, MF_MT_PIXEL_ASPECT_RATIO, 1, 1);
I've attached two sample videos. 1.mp4 is encoded using AMDh264Enc, 2.mp4 is encoded using Microsoft Media Foundation H.264 software encoder, everything else is the same. Does anyone have any idea on how to correct this issue?