Search code examples
directshowwindows-media-playermpeg-2ms-media-foundation

decode MPEG1/2 video with Media Foundation


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


Solution

  • 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.