Make MediaElement support more video codecs

妖精的绣舞 提交于 2019-12-17 18:57:37

问题


Is there a way to make MediaElement support more video codecs like mkv, flv, mov etc.? If not, is there any other control that supports more video codecs?


回答1:


Have you seen the Player Framework? It's an open source component supporting Windows 8, part of the Microsoft Media Platform, and developed by Microsoft. It's an alternative to the standard MediaElement control, and provides a plug-in mechanism. I'm not sure whether you can support extra codecs through this mechanism though.

Other than that, you can also extend the media platform (the extension has to be written in C++ though) as shown in these samples provided by Microsoft:

  • Media Extension Sample
  • MediaStreamSource media extension sample

The second example is very interesting as it's a sample media extension adding the MediaStreamSource mechanism as in Silverlight. Thanks to this extension you could implement your own MediaStreamSource in C#/VB.NET providing content to the MediaElement.




回答2:


It seems impossible as WinRT has completely different set of API and all existing win32 based codecs won't run unless codec owners rewrite them. One long way will be to port win32 code into winrt which will require in depth knowledge of both and seems way too long to do it. Even if somehow you will find way to make existing codec work, it will not work on arm based windows 8 tablets.

This means, there are no codecs for winrt other then Microsoft has provided.

Your options are to convert them into h.264 video, which has become a standard as h.264 plays on all devices. Apple did great job by standardizing video. Win 7 onwards, microsoft has provided inbuilt support for h.264.




回答3:


MediaElement plays whatever the windows media player can play. So if you have the right set of codecs installed on your PC it can be a pretty versatile media player.

Personally I have installed K-Lite codecs

As well as Media_player_codec_pack codecs

And now my Windows Media Player doesn't lag anymore when playing mp4 files. Just follow the suggestion of the installer and restart your PC BEFORE starting the installation process. Also... it attempts to trick you with dialogs to install secondary software so BEWARE!!

Once Installed, just remember to experiment with the "preferred acceleration" parameter in the application's video settings, to see what goes better according to your hardware. I have set it to - CUVID.

I also installed this set of codecs to support avi format

Hope this helps :)



来源:https://stackoverflow.com/questions/12268668/make-mediaelement-support-more-video-codecs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!