locked
Is there a solution for MPEG-2 video support with Media Foundation on 64 bit systems? RRS feed

  • Question

  • Hello all,

    After spending considerable time migrating my application to use Media Foundation, I was surprised to find that I can't play MPEG-2 files.  After some searching, I found the following:

    https://msdn.microsoft.com/en-us/library/windows/desktop/hh162909%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

    The specifically:

    Limitations

    • The decoder is not supported on IA-64–based platforms.

    Is there a technical reason that 64 bit platforms can't support MPEG-2?  I'm dumbfounded that I can use Media Player to show the files, but not Media Foundation.

    Thanks in advance for any help.

    -Mike

    Monday, November 13, 2017 3:34 PM

All replies

  • Most recent Windows update (Windows 10 Fall Creators Update) improved MPEG-2 support in Media Foundation and added new MPEG-2 video decoder MFT, codename "MPEG2 Video Extension".

    I don't think it's reflected in the documentation anywhere yet https://msdn.microsoft.com/en-us/library/windows/desktop/hh162909 and in fact the documentation states that support for MPEG-2 existed before.

    There might be a problem with resolution and profile cap. I just checked that I can play MPEG-2 Main Profile video through Media Foundation.

    Also note that IA-64 is Itanium architecture, as opposed to wider spread 64-bit x86-64/AMD64 architecture.

    EDIT: I might be wrong implying that MPEG-2 decoding is brought by Windows 10 update. Rather, it could have been an extension installed with this free Windows Store extension https://www.microsoft.com/store/productId/9N95Q1ZZPMH4


    <a href="http://alax.info/blog/tag/directshow">http://alax.info/blog/tag/directshow</a>



    Monday, November 13, 2017 4:22 PM
  • Thank you for the Windows Store suggestion.  Unfortunately, the Free/Download button is disabled in the Store for me.  I'm working with my IT department to see why that is.  I'll follow up once I can apply the extension.
    Monday, November 13, 2017 10:30 PM
  • It looks like there is a new MPEG-2 decoder (either Fall Creators Update or store extension, presumably the latter).

    This is the old one (Windows 8+):

    ## Microsoft MPEG Video Decoder MFT

    6 Attributes:

     * MFT_TRANSFORM_CLSID_Attribute: {2D709E52-123F-49B5-9CBC-9AF5CDE28FB9} (Type VT_CLSID)
     * MF_TRANSFORM_FLAGS_Attribute: MFT_ENUM_FLAG_SYNCMFT
     * MFT_INPUT_TYPES_Attributes: MFVideoFormat_MPEG2, MFVideoFormat_MPG1
     * MFT_OUTPUT_TYPES_Attributes: MFVideoFormat_NV12, MFVideoFormat_YV12, MFVideoFormat_IYUV, MFVideoFormat_I420, MFVideoFormat_YUY2

    And now this is the new one (perhaps it works for Store apps as well?):

    ## MPEG2VideoExtension

    12 Attributes:

     * MF_TRANSFORM_FLAGS_Attribute: MFT_ENUM_FLAG_SYNCMFT
     * MFT_INPUT_TYPES_Attributes: MFVideoFormat_MPEG2, MFVideoFormat_MPG1
     * MFT_OUTPUT_TYPES_Attributes: MFVideoFormat_NV12, MFVideoFormat_IYUV, MFVideoFormat_I420, MFVideoFormat_YV12, MFVideoFormat_YUY2
     * {3C0FBE52-D034-4115-995D-95B356B9855C}: 1 (Type VT_UI4)
     * {7347C815-79FC-4AD9-877D-ACDF5F46685E}: C:\Program Files\WindowsApps\Microsoft.MPEG2VideoExtension_1.0.6.0_x64__8wekyb3d8bbwe\x64\msmpeg2vdec_store.dll (Type VT_LPWSTR)
     * {957193AD-9029-4835-A2F2-3EC9AE9BB6C8}: Microsoft.MPEG2VideoExtension_1.0.6.0_x64__8wekyb3d8bbwe (Type VT_LPWSTR)
     * {9D8B61A8-6BC8-4BFF-B31F-3A31060AFA3D}: Microsoft.MPEG2VideoExtension_8wekyb3d8bbwe (Type VT_LPWSTR)
     * {BB49BC51-1810-4C3A-A9CF-D59C4E5B9622}: {2C22097D-7126-4833-85CB-A997AA3B3739} (Type VT_CLSID)
     * {DE106D30-42FB-4767-808D-0FCC6811B0B9}: MPEGDecoder.MFTMPEGDecoderTransform (Type VT_LPWSTR)
     * {F9542F80-D069-4EFE-B30D-345536F76AAA}: 0 (Type VT_UI4)

    ### IMFTransform

     * Stream Limits: Input 1..1, Output 1..1
     * Streams: Input 1, Output 1

    #### Attributes

     * MF_SA_D3D11_AWARE: 1 (Type VT_UI4)
     * CODECAPI_AVDecVideoThumbnailGenerationMode: 0 (Type VT_UI4)
     * {592A2A5A-E797-491A-9738-C0007BE28C52}: ??? (Type VT_UNKNOWN, 0x0000028BB26A8BF0)
     * MF_LOW_LATENCY: 0 (Type VT_UI4)
     * MF_SA_D3D_AWARE: 1 (Type VT_UI4)
     * MFT_DECODER_EXPOSE_OUTPUT_TYPES_IN_NATIVE_ORDER: 0 (Type VT_UI4)
     * CODECAPI_AVDecVideoAcceleration_MPEG2: 1 (Type VT_UI4)


    <a href="http://alax.info/blog/tag/directshow">http://alax.info/blog/tag/directshow</a>


    Monday, November 13, 2017 10:44 PM
  • Today I was finally able to get out IT group to finish updates on my computer.  I am now Win10 Version 1703 (Build 15063.726).

    I was also able to download the MPEG-2 Extension from the store.

    MPEG-2 videos still don't play through Media Foundation.

    Still looking for a solution...

    Wednesday, November 15, 2017 3:18 PM
  • Any sample files? Vice versa, can you play this sample MPEG-2 video file?


    http://alax.info/blog/tag/directshow

    Wednesday, November 15, 2017 3:33 PM
  • Any sample files? Vice versa, can you play this sample MPEG-2 video file?


    http://alax.info/blog/tag/directshow

    Thank you for the sample file.  Strangely, that file did play through my program.

    I used the tool "gspot", and noticed that your sample uses the MPEG2 codec, whereas mine indicates H264.  Perhaps this is the reason mine fails in Media Foundation?

    Thursday, November 16, 2017 3:39 PM
  • This basically invalidates the topic right from its start. The media files that don't play for you are H.264. Perhaps wrapped in MPEG-2 TS format. Apparently something is not accepted by MF decoder, but it does not look like a lack of MPEG-2 video support.

    http://alax.info/blog/tag/directshow

    Thursday, November 16, 2017 3:59 PM
  • @internal access 54 and @Roman - Thank you for all of your help! I downloaded a copy of Windows DVD Player (evaluation), and still no luck.

    I am running Win10 Enterprise.

    Here is a link that I hope will allow you to download a short video: https://drive.google.com/file/d/17AL6zLdHU947p9dNQKyfb6iykaalGn25/view?usp=sharing


    • Edited by MikeTyler Thursday, November 16, 2017 11:30 PM
    Thursday, November 16, 2017 11:29 PM
  • I think it's a problem with support for MPEG-2 PS in Media Foundation. H.264 video itself is playable but MPEG-2 PS wrapping is not recognized.

    Media Foundation's MPEG-2 Source (hosted by Media Foundation MPEG2 Source and Sink DLL; mfmpeg2srcsnk.dll) is not even documented, as it seems, and maybe it handles just MPEG-2 TS and not MPEG-2 PS. With no documentation we are unaware of constraints.

    I still don't think MPEG-2 Video Decoder is supposed to handle your file - it would jump in in MPEG-2 ES case.

    Note that Supported Media Formats in Media Foundation has no mention of support of MPEG-2 PS, even though MPEG-2 TS is supported but not mentioned.

    All in all, I think missing support of your flavor of a media file is expected behavior with Media Foundation.


    http://alax.info/blog/tag/directshow

    Friday, November 17, 2017 8:24 AM
  • @internal - thank you again for such a detailed response.  My app was previously using DirectShow, but I (perhaps mistakenly) thought that Microsoft was encouraging Media Foundation as its replacement.  If I can't get the requirement for this type of file dropped, I guess I'll need to look into utilization of both DirectShow and Media Foundation.
    Friday, November 17, 2017 3:39 PM
  • @Roman - Thank you for your help!  I guess I can't rely on Media Foundation alone if I need to support this specific format.
    Friday, November 17, 2017 3:41 PM
  • I agree with everything but one thing.

    There is no real use of DirectShow and MFDS wrapper here in MPEG-2 input case.

    When WMP falls back to DirectShow, it discards the entire Media Foundation pipeline and builds DirectShow only replacement. Hence, no need in MF/DS adapters.

    MF MPEG-2 source is MF component which does not (presumably of course, but it's an educated guess) recourse to DS. Microsoft's assumed approach is to remove MF dependency on DS. Yes they do share primitives on the backyard, but MF components don't have direct DS dependencies. MFDS hosts MFT wrap over DS filter, which is clearly a helper component to ease the transition to MF rather than be a real base block for MF pipelines in long term. With the low popularity of MF, I think MFDS is extremely rarely used in real life.

    So my bet is that Media Foundation MPEG-2 Source is a MF implementation for MPEG-2 TS source. It does not handle MPEG-2 PS and might have other limitations.

    DirectShow primitives are hard to consume outside of filter graph. Filter graphs are nicely traceable with my DirectShowSpy tool and I see no use of DirectShow pipelines when topoedit plays MPEG-2 TS using Media Foundation MPEG-2 Source.


    http://alax.info/blog/tag/directshow

    Friday, November 17, 2017 8:28 PM