Code Monkey home page Code Monkey logo

ffmediaelement's Introduction

FFME: WPF MediaElement Alternative

Analytics

⭐Please star this project if you find it useful!

Features Overview

FFME is a close 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 be the answer.

FFME implements additional improvements over the standard MediaElement such as:

  • Asynchronous and synchronous frame scrubbing
  • Fast media seeking
  • Frame-by-frame seeking
  • Media properties such as Position, NaturalDuration, SpeedRatio, and Volume (among others) are exposed as dependency properties
  • Additional and extended media events

... all in a self-contained assembly (dll)

Known Limitations

Your help is welcome!

  • SpeedRatio other than 1.0 should adjust audio pitch. Currently, if SpeedRatio is less than 1.0, there is no audio playback, and if SpeedRatio is greater than 1.0, samples just play faster. This situation can be greatly improved by manually manipulating the samples passed to NAudio.
  • (To be confirmed) Writing to the Position dependency property from another dependency property may make the source value lose synchronization with the target value.
  • (Nice to have) It would be nice to implement a method on the control that is able to extract a copy of the current video frame.
  • 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.

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

  1. Clone this repository.
  2. Before you open the solution, please make sure you download the FFmpeg win32-shared binaries from Zeranoe FFmpeg Builds.
  3. Extract the contents of the 7z file you just downloaded and locate the bin folder.
  4. You should see 3 exe files and 8 dll files. Select and copy all of them.
  5. Now paste all 11 files from the prior step onto the following folder (inside the cloned repository): {repositiories root}\ffmediaelement\Unosquare.FFmpegMediaElement\ffmpeg32.
  6. Open the solution and set the Unosquare.FFmpegMediaElement.Tests project as the startup project. You can do this by right clicking on the project and selecting Set as startup project
  7. Click on Start to run the project.
  8. You should see a very simplistic media player. Enter a URL or a path to a file in the textbox at the top of the window and then click on Open.
  9. The file or URL should play immediately.
  10. You can use the resulting compiled assembly in your project without further dependencies FFME is entirely self-contained. The locations of the compiled FFME assembly, depending on your build configuration are either ...\ffmediaelement\Unosquare.FFmpegMediaElement\bin\Debug\Unosquare.FFmpegMediaElement.dll or ...\ffmediaelement\Unosquare.FFmpegMediaElement\bin\Release\Unosquare.FFmpegMediaElement.dll

Using FFME in your Project

The Unosquare.FFmpegMediaElement.Tests project shows most common usages

  1. Create a new WPF application
  2. Add a reference to Unosquare.FFmpegMediaElement.dll
  3. In your MainForm.xaml, add the namespace: xmlns:ffme="clr-namespace:Unosquare.FFmpegMediaElement;assembly=Unosquare.FFmpegMediaElement"
  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

Similar Projects

License

  • The NAudio portion of this library Unosquare.FFmpegMediaElement\NAudio is distributed under Ms-PL. Please see LICENSE.txt.
  • Code generated by the FFmpeg.Autogen tool Unosquare.FFmpegMediaElement\FFmpeg.Autogen does not specify a license by the tool's author.
  • The source code of the FFME project excluding the items above is distributed under the Ms-PL.

ffmediaelement's People

Contributors

mariodivece avatar keboo avatar

Stargazers

Nasirov Shavkat avatar

Watchers

James Cloos avatar Nasirov Shavkat avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.