Skip to content

dmg61/EmotionTagging

Repository files navigation

FFME: WPF MediaElement Alternative

Analytics Build status

⭐Please star this project if you find it useful!

ffmeplay

Features Overview

FFME is a close (and I'd like to think better) drop-in replacement for Microsoft's WPF MediaElement Control. While the standard MediaElement uses DirectX (DirectShow) for media playback, FFME uses FFmpeg to read and decode audio and video. This means that for those of you who want to support stuff like HLS playback, or just don't want to go through the hassle of installing codecs on client machines, using FFME might just be the answer.

FFME provides multiple improvements over the standard MediaElement such as:

  • Fast media seeking and frame-by-frame seeking
  • Properties such as Position, NaturalDuration, SpeedRatio, and Volume are all Dependency Properties!
  • Additional and extended media events. Extracting video, audio and subtitle frames is very easy.
  • Ability to easily apply video filtergraphs.
  • Ability to extract media metadata and tech specs of a media stream (title, album, bitrate, codecs, FPS, etc).
  • Ability to apply volume, balance and speed ratio to media playback.

... all in a single MediaElement control

Known Limitations

Your help is welcome!

  • I still have some items I need to address. See the issues section.
  • Working on Hardware acceleration D3D 9 and D3D 11
  • There currently is no support for opening capture devices such as webcams or TV cards. While this is not too hard to do, it is not (yet) implemented in this library. See issue #48

Compiling, Running and Testing

Please note that I am unable to distribute FFmpeg's binaries because I don't know if I am allowed to do so. Follow the instructions below to compile, run and test FFME. I will look into releasing a NuGet package. See issue #1

  1. Clone this repository.
  2. Download the FFmpeg win32-shared binaries from Zeranoe FFmpeg Builds.
  3. Extract the contents of the zip file you just downloaded and go to the bin folder that got extracted. You should see 3 exe files and 8 dll files. Select and copy all of them.
  4. Now paste all 11 files from the prior step onto a well-known folder. Take note of the full path. (I used c:\ffmpeg)
  5. Open the solution and set the Unosquare.FFME.Sample project as the startup project. You can do this by right clicking on the project and selecting Set as startup project
  6. Under the Unosquare.FFME.Sample project, locate the line public string FFmpegPath { get; set; } = @"C:\ffmpeg"; and replace the path so that it points to the folder where you extracted your FFmpeg binaries (dll files).
  7. Click on Start to run the project.
  8. You should see a sample media player. Click on the Open icon located at the bottom right and enter a URL or path to a media file.
  9. The file or URL should play immediately, and all the properties should display to the right of the media display by clicking on the Info icon.
  10. You can use the resulting compiled assembly in your project without further dependencies as FFME is entirely self-contained. The locations of the compiled FFME assembly, depending on your build configuration are either ...\ffmediaelement\Unosquare.FFME\bin\Debug\Unosquare.FFME.dll or ...\ffmediaelement\Unosquare.FFME\bin\Release\Unosquare.FFME.dll

Using FFME in your Project

Remember: The Unosquare.FFME.Sample provides a reference implementation of usage

  1. Create a new WPF application
  2. Add a reference to Unosquare.FFME.dll
  3. In your MainForm.xaml, add the namespace: xmlns:ffme="clr-namespace:Unosquare.FFME;assembly=Unosquare.FFME"
  4. Finally, create an instance of the FFME control in your MainForm.xaml as follows: <ffme:MediaElement x:Name="MediaEl" Background="Gray" LoadedBehavior="Play" UnloadedBehavior="Manual" />

Thanks

In no particular order

  • To the FFmpeg team for making the Swiss Army Knife of media. I encourage you to donate to them.
  • To Kyle Schwarz for creating and making Zeranoe FFmpeg builds available to everyone.
  • To the NAudio team for making the best audio library out there for .NET -- one day I will contribute some improvements I have noticed they need.
  • To Ruslan Balanukhin for his FFmpeg interop bindings generator tool: FFmpeg.AutoGen.
  • To Martin Bohme for his tutorial on creating a video player with FFmpeg.
  • To Barry Mieny for his beautiful FFmpeg logo

Similar Projects

License

  • Please refer to the LICENSE file for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published