1
votes

I'm testing how to integrate libavcodec (http://en.wikipedia.org/wiki/Libavcodec) using MS Media Foundation SDK, in order to decode h264-lossless format video to YUV/RGB raw data

I have 2 question:

  1. I have had issues to load mp4 video encoded with h264/AVC (in regular, not lossless format) into MFPlayer (compiled in VS2010 from MF SDK examples), the error code was: bad byte stream. The same error occurred, when I tried to load the same video as stream (source reader code taken from http://msdn.microsoft.com/en-us/library/dd389281%28v=VS.85%29.aspx) or as session using trans-codding example. May be anyone may share experience how to use Media Foundation to load mp4-h264 video.

  2. I should to integrate third-party codec to Media Foundation based decoding. According to MSDN, Media Foundation has some support to third-party codecs, however I didn't find example that does decoding using third-party codec. May be someone did that ? or may reference to usable example how to do that.

Thanks in advance, Ze'ev

1
Hi Ze'ev, I'm trying something similar but am struggling to get the decoder work on "SetInputType". Could you help me on this. Please check my question on: social.msdn.microsoft.com/Forums/en-SG/…mots_g
Intel has a sample decoder MFT in their current Media SDK (which is free for download). you might give it a tryJoachim Kerschbaumer

1 Answers

0
votes

(2) I should to integrate third-party codec to Media Foundation based decoding. According to MSDN, Media Foundation has some support to third-party codecs, however I didn't find example that does decoding using third-party codec. May be someone did that ? or may reference to usable example how to do that.

This is possible. Basically, it involves writing a Media Foundation Transform for the third party decoder. Look into your SDK installation directory. Go to Microsoft SDKs -> v7.0 -> Samples -> Multimedia -> Mediafoundation -> Decoder. It contains a sample MPEG1 decoder MFT. What you need to do is appropriately inherit IMFTransform interface and implement its methods. For example, a media client will call ProcessInput() method to provide your decoder MFT with media samples. Similarly it will call ProcessOutput() to get the decoded output. In short, MFT acts as a wrapper for the third party decoder.