locked
decode IMFSample by SourceReader? RRS feed

  • Question

  • Hi,

    I want to use the SourceReader to read frames from a URL (video file) - without using the decoding part. If I`m right, I have to set the output format with the type returned by GetNativeMediaType.

    In the end I will receive an IMFSample object containing the encoded / compressed video frame. Is it possible to get the specific frame type (GOP: I, P, B frame)?

    In a second step I want to decode this encoded video frame without loading it again from the source file. Could you tell me the simplest way to do that? Should I use a custom media source and the SourceReader API again - using MFCreateSourceReaderFromMediaSource? The custom media source will contain the encoded video frame. Or is there a much easier method to acchieve that?

    best regards

    saoirse

    Wednesday, March 11, 2015 7:42 PM

All replies

  • I'm not sure if MF provides a high level way of telling the frame type, but you should be able to get it on your own from the "picture header". Fifth byte of the mpeg header contains information that you need. Ask Google for "mpeg header", "temporal reference", "picure header" and maybe even ISO/IEC 13818.

    Regarding the second part, you can feed the decoder with frames manually. Simply create IMFTransform that you need. Once you configure input/output you are ready for decoding. Read MSDN on calling IMFTransform::ProcessInput()/IMFTransform::ProcessOutput().

    • Edited by nosati_shtakor Thursday, March 19, 2015 10:31 PM added extra info
    Thursday, March 19, 2015 10:27 PM