Skip to main content

 none
Try RAW Decode h.264 IMFSample RRS feed

  • Question

  • HI All

    I use windows 10 x64. c# http://mfnet.sourceforge.net/

    I described the H.264 encoder, I get the IMFSample output with frames, which I immediately send to the Microsoft Microsoft H264 Video Decoder MFT Software Decoder for verification. All the IMFSample that I send are received by the system well, but I haven’t received the long-awaited SampleReady on it, I waited and 20 and 30 seconds.

    Below settings Output transform settings:

    LastError = MFExtern.MFCreateMediaType(out mediaTypeOut);

    LastError = mediaTypeOut.SetGUID(MFAttributesClsid.MF_MT_MAJOR_TYPE, MFMediaType.Video);

    LastError = mediaTypeOut.SetGUID(MFAttributesClsid.MF_MT_SUBTYPE, MFMediaType.H264);
    LastError = mediaTypeOut.SetUINT32(MFAttributesClsid.MF_MT_AVG_BITRATE, profileInfo.Bitrate);
    LastError = mediaTypeOut.SetUINT32(MFAttributesClsid.MF_MT_MPEG2_PROFILE, profileInfo.Profile);
    LastError = MFExtern.MFSetAttributeSize(mediaTypeOut, MFAttributesClsid.MF_MT_FRAME_SIZE, Width, Height);
    LastError = MFExtern.MFSetAttributeRatio(mediaTypeOut, MFAttributesClsid.MF_MT_FRAME_RATE, 15, 1);
    LastError = MFExtern.MFSetAttributeRatio(mediaTypeOut, MFAttributesClsid.MF_MT_PIXEL_ASPECT_RATIO, 1, 1);
    LastError = mediaTypeOut.SetUINT32(MFAttributesClsid.MF_MT_INTERLACE_MODE, (uint)MFVideoInterlaceMode.Progressive);
    LastError = mediaTypeOut.SetUINT32(MFAttributesClsid.MF_MT_ALL_SAMPLES_INDEPENDENT, 1u);
    LastError = retTransform.SetOutputType(0, mediaTypeOut, MFTSetTypeFlags.None);

    I copy the settings and transfer them to the Decoder’s Input MediaType

    And Output MediaType for decoder

    _lasterror = _transform.GetOutputAvailableType(0, 0, out IMFMediaType ppType);
    _lasterror = MFExtern.MFCreateMediaType(out IMFMediaType mediaOutType);
    _lasterror = mediaOutType.SetGUID(MFAttributesClsid.MF_MT_MAJOR_TYPE, MFMediaType.Video);
    _lasterror = mediaOutType.SetGUID(MFAttributesClsid.MF_MT_SUBTYPE, MFMediaType.NV12);
    _lasterror = mediaOutType.SetUINT32(MFAttributesClsid.MF_MT_INTERLACE_MODE, (uint)MFVideoInterlaceMode.Progressive);
    _lasterror = MFExtern.MFSetAttributeRatio(mediaOutType, MFAttributesClsid.MF_MT_FRAME_RATE, 15, 1);
    _lasterror = MFExtern.MFSetAttributeRatio(mediaOutType, MFAttributesClsid.MF_MT_PIXEL_ASPECT_RATIO, 1, 1);
    _lasterror = MFExtern.MFSetAttributeSize(mediaOutType, MFAttributesClsid.MF_MT_FRAME_SIZE, Width, Height);
    _lasterror = mediaOutType.SetUINT32(MFAttributesClsid.MF_MT_AVG_BITRATE, profileInfo.Bitrate);
    _lasterror = mediaOutType.SetUINT32(MFAttributesClsid.MF_MT_ALL_SAMPLES_INDEPENDENT, 1u);
    _lasterror = retTransform.SetOutputType(0, mediaOutType, MFTSetTypeFlags.None);

    But nothing happens, decoding does not work. If you write the resulting IMFSample to a file in h264 format, then you can watch it as a regular video.

    Tell me what I'm missing or if there is not enough code, I can lay out more.

    Monday, November 18, 2019 5:22 AM

All replies

  • Hi,

    Thank you for posting here.

    For the issue, I will discuss with relevant engineers. As soon as there is  a conclusion,  I will update in the first time.

    Best regards,

    Jeffrey


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    17 hours 32 minutes ago