1

MediaPlayer - Can 'MediaElement' be improved to support more media formats and encodings?

Codecs support.

Hello all.

I am building a media player in c# and WPF. All the examples that I find, more or less say the same thing, "place a 'mediaElement' and the basic player buttons and there you go!"

I thought that the mediaElement is essentially the windows media player, but I already found cases where videos play, but show a black screen, while the audio track plays normally, and others where the scrubbing on the timeline takes a lot of time. Also I noticed that when I load a video in this type of player, K-lite codecs doesn't seem to load on the bottom right part of the windows taskbar like they usually do when I use VLC player or Media Player Classic for example.

I 've already found another topic stating that: "The MediaElement is a control that's able to play only some file types. It's based on media player of windows but only on its core encoders. Its basically a bare-bones media player"

Do the issues I am having with the video playback have to do with limited codec support? Is it enough that I have K-lite codecs installed or is there something else that I am missing?

Lastly, in the case that this is as good as mediaElement gets, what alternatives are there? I 've seen people open VLC through their players, but I would like to know what other alternatives are available as well before I dive into that. I ve seen that Microsoft now has "Player Framework" available for Windows 8 for example, but is it only for windows 8?

Thank you all in advance!

Ibizanhound
  • 91
  • 2
  • 12

2 Answers2

1

The MediaElement only supports a limited range of input options, as discussed here: What formats does the MediaElement support?

The Player Framework currently supports:

  • Windows Phone 8.1 (Windows Phone Store app) support for Xaml/C#/VB.NET apps

  • Windows Phone 8.1 (Windows Phone Store app) support for JavaScript/HTML apps

  • Windows Phone 8 & 8.1 (Silverlight) support

  • Windows Phone 7.5 support

  • Windows 8.0 (Xaml and HTML versions)

  • Windows 8.1 support for both Xaml and HTML apps

  • Universal app support for both Xaml and HTML apps

Source: https://playerframework.codeplex.com/wikipage?title=Version%202%20changes

Having worked with an unholy mess of different player/recorder/streamer/media things generally, I think your best bet for universal playback support is either MPlayer or VLC. WPF wrappers exist for both

I can vouch for Vlc.DotNet (https://github.com/ZeBobo5/Vlc.DotNet) as a media player option for WPF/WinForms. It's a little miserable getting over the learning curve, but worthwhile for the truly vast array of options. There are very few media tasks that you can't pull off with it one way or another.

There are half a dozen semi-complete wrappers for MPlayer. If your functionality only goes as far as playback (no recording/streaming/etc.) then something like MPlayerControl might fit the bill: https://github.com/majorsilence/MPlayerControl .

Community
  • 1
  • 1
goobering
  • 1,547
  • 2
  • 10
  • 24
  • Thank you very much goobering!!! I will look into both of MPlayer which is my personal favorite and vlc which I already noticed that has strong integration in WPF and a strong community behind it. – Ibizanhound Apr 08 '15 at 06:21
0

Ok so I am happy to announce that I was wrong on a couple of observations and that there is a solution to improve the support for popular media formats, such as mp4, in windows media player and therefore in medialement!!!

So I was wrong to say that the media element is not really Windows media Player but rather a "bare-bones media player". It is indeed windows media player and it just needs the right set of codecs to be able to play more formats.

I already had K Lite codecs installed and I added this set of codecs http://www.majorgeeks.com/files/details/media_player_codec_pack.html and now my windows media player doesnt 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 http://www.free-codecs.com/Combined_Community_Codec_Pack_download.htm

Hope this helps :)

Ibizanhound
  • 91
  • 2
  • 12