I am using Media Foundation to play videos. On windows 7 some videos encoded with Mpeg1/Mpeg2 PS and Windows Media Player can play them, but Media Foundation does not(I tried to register a stub MPEG1Source but it still does not work). I noticed some of these files could be played with directshow but not Media foundation(can not be open at all). I guess "media player" does not use Media Foundation only?
Is it possible to use Media Foundation to play these file? If it is not, how does Media player work? Thanks a lot.
P.S. I have read the windows SDK and I registered a "fake" mpeg1 decode and it shows a blank frame with no time code. Why we need a fake mpeg1 decoder if windows media player can decode it?
This topic is relative to best way to build graph for MPEG2 transport stream
Media Foundation does not have inbox support for MPEG-1 or MPEG-2. See: http://msdn.microsoft.com/en-us/library/dd757927(v=VS.85).aspx
Windows Media Player uses various code paths, including DShow, Media Foundation, and Windows Media Format SDK, depending on the source content.
I have found some information about this question and set up a MPEG1 source with the fake decoder. The failure I've been through is because bugs in SDK's code. About the MPEG1 decoder, I guess I have to use DShow's decoder in MF. Still have no idea about how MediaPlayer works.
In your Microsoft SDK installation directory, go to Microsoft SDKs -> Windows v7.0 -> Samples -> multimedia -> mediafoundation -> Decoder
which contains an example MPEG-1 Decoder MFT. You might find it helpful.
There is new MPEG-2 Video Decoder MF filter at Windows 8. http://msdn.microsoft.com/en-us/library/windows/desktop/hh162909(v=vs.85).aspx
来源:https://stackoverflow.com/questions/5495490/decode-mpeg1-2-video-with-media-foundation