none
Media Foundation FLAC codec not used

    Question

  • After installing the FLAC MediaFoundation codec, it is possible to play FLAC files in Media Player. Also in TopoEdit, the FLAC files open and play flawlessly, in both x86 and x64. But if I try to open the same file in MediaElement or in IMFMediaEngine, i get MF_MEDIA_ENGINE_ERR_SRC_NOT_SUPPORTED. Why is that? I also provide the mime type "audio/flac" as shown in TopoEdit. Still no success. And I do use the correct way, providing the WinRT file stream instead of the file name. For mp3 files this all works properly.

    Can anyone comment on this? Both MediaElement and MediaEngine should use the installed codec.

    Here you can download the codec: http://sourceforge.net/projects/mfflac/

    Any help is appreciated. I really need to get FLAC files working (and any other file where codecs are installed).

    Monday, August 27, 2012 9:22 PM

Answers

  • Hello Lukas,

    This behavior is by design. In order for you to use your FLAC MF codec from within the context of your Windows store app you will need to modify the codec to work in the WinRT environment. You will then need to ship the codec with your application rather than rely on a desktop installation. If you need help converting your FLAC MF codec to work in the WinRT environment please let me know.

    I hope this helps,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, August 27, 2012 9:53 PM

All replies

  • Hello Lukas,

    This behavior is by design. In order for you to use your FLAC MF codec from within the context of your Windows store app you will need to modify the codec to work in the WinRT environment. You will then need to ship the codec with your application rather than rely on a desktop installation. If you need help converting your FLAC MF codec to work in the WinRT environment please let me know.

    I hope this helps,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Monday, August 27, 2012 9:53 PM
  • Hi James, do I understand correctly: It is not possible to use any installed codecs from within a Metro app, except for the official ones?

    I was hoping to be able to play a lot more file formats once more MediaFoundation codecs appear. This is not my FLAC codec and sources are not fully available so modifying is also not possible. Are app developers really supposed to write or buy all codecs they want to support themselves? I am a bit shocked.

    And if I am correct, are there any plans on improving that situation? Like extending the rather limited format support? Or having a program to certify 3rd party codecs, to make them available for Metro apps?
    • Edited by Lukas F Tuesday, August 28, 2012 8:24 AM
    Tuesday, August 28, 2012 8:22 AM
  • I can understand why this restriction is in play. Metro applications need to run across both Intel and ARM platforms and there is no guarantee that a custom CODEC would install and work on a system wide basis across both platforms. Also, installing CODECS that are not sandboxed in an application space introduces the same security and reliability risks of installing arbitrary browser plug-ins.


    Tuesday, August 28, 2012 2:34 PM
  • Thinking of sandboxing, I can understand why arbitrary desktop codecs cannot be used.

    However, having an extensible, codec based media decoding engine is what DirectShow and MediaFoundation are all about. For sandboxed Metro apps, it would be great to also have access to an extensible collection of codecs - sandboxed codecs! It should be possible to create a separate codec registry, where only approved, sandboxed codecs are registered. Such codecs could get distributed through the windows store, go through the same verification, and could then be used by any metro app.

    Are there any plans on improvements in this area?

    Tuesday, August 28, 2012 3:10 PM
  • Hello Lukas,

    Here are the answers to your questions:

    Q. It is not possible to use any installed codecs from within a Metro app, except for the official ones?
    A. It is currently not possible to use 3rd party codecs that were installed from the desktop from within your Windows store app.

    Q. Are app developers really supposed to write or buy all codecs they want to support themselves?
    A. Yes. There is a long and sordid history of 3rd party codecs on Windows. The WinRT implementation is in response to years of lessons learned. We did not make this decision lightly but rather deliberately.

    Q. And if I am correct, are there any plans on improving that situation?
    A. The future of 3rd party plug-in support is still up in the air. However, we are aware of this perceived limitation and are discussing it internally. Again this is not a promise of future functionality. Only an admittance of internal awareness.

    I hope this helps,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Wednesday, August 29, 2012 9:04 PM
  • Hi James,

    thanks for your response! I can understand why this decision has been made, and I am glad that you are aware of the problems it creates for developers. Please note the following thoughts about this:

    As long as the codec support is so heavily limited, for both audio and video playback, developers of multi media apps will be very strongly tempted to create "full blown" desktop versions of their applications, which will provide a much better experience for their users, as opposed to the "Metro" version. At least that is the path that my application(s) will take. While for the "basic" user, mp3 and wma playback might be enough, there are a lot of audiophiles out there that will not use any app which does not support FLAC and other lossless codecs. Sadly, the audiophiles are the ones that would most likely pay for a decent application. The situation is even worse for video playback: MKV is one of the most used container formats along the web. Even almost all DVD and BluRay hardware players do support it. If a video player app does not support MKV, it will probably be useless for the vast majority of users.

    My original plan was to release my Metro music application and then build a Metro video player application. Now that I see all those limitations (no codec support, no gapless playback using Sqeuencer Source), my plan has changed to first release the metro music application, then build a much improved desktop version of it, and then build a desktop video player application (with no Metro version of it at all). Originally I wanted to have 100% metro, now it looks more look like 33% metro and 67% desktop.

    If the vision of Microsoft is to transfer the whole market (or at least the biggest amount) to Metro and the Windows Store, then you will absolutely need to come up with a solution for these issues. Otherwise you will see developers continue to develop more and more desktop applications. Even if they would love to do them as Metro, they simply can't because of the limitations.

    Kind Regards, Lukas

    Thursday, August 30, 2012 8:54 AM
  • Nicely put, Lukas.  I'm not sure the Mountain (MSFT) can be moved on this issue, but continued lack of support for FLAC means a cascading set of decisions by developers, technorati, early adopters, and decision-makers.    I hope and pray Microsoft will not squander its one enormous advantage over Apple -- a more open environment for third-party innovators like you.

    James, thank you for your straightforward answers, but Microsoft must listen to Lukas who is spot on about what will happen if Microsoft fails to address these issues.  I would add, more rudely and crudely:  lack of support for FLAC is an incomprehensible failure to seize a natural advantage and a symptom of larger blind spots in Microsoft's vision.  The "long and sordid history of 3rd party codecs on Windows" is no doubt part of the truth, but why do so many people find it necessary to find workarounds like Shark007 just to get things to work that should work "out of the box."  The long and sordid history would come to an end in a heartbeat if Windows came with the codecs we need.  If VLC can do it, surely MSFT can!

    Friday, January 25, 2013 3:58 AM
  • Although there is no "registry of sandboxed codecs", your Windows Store app can include its own Media Foundation codec.  The codec will be usable only by your app. 

    If you already have a Media Foundation codec that you plan to include in your desktop app, then the same codec will also work if included in your Windows Store app, provided that your codec does not invoke restricted APIs.

    Only some minor modifications are required:  Your decoder has to be a RuntimeClass and implement the Windows.Media.IMediaExtension interface.  You will use the RegisterAudioDecoder method on the Windows.Media.MediaExtensionManager class to register your codec.

    This page has some code samples: http://code.msdn.microsoft.com/windowsapps/media-extensions-sample-7b466096

    Friday, February 15, 2013 5:28 AM