Solid FFmpeg wrapper for C#/.NET
I have been searching the web for some time for a solid FFmpeg wrapper for C#/.NET. But I have yet to come up with something useful. I have found the following three projects, but all of them apears to be dead in early alpha stage.
FFmpeg.NET
ffmpeg-sharp
FFLIB.NET
So my question is if anyone knows of a wrapper project that is more mature?
I am not looking for a full transcoding engine with job queues and more.
Just a simple wrapper so I do not have to make a command line call and then parse the console output, but can make method calls and use eventlisteners for progress.
And please feel free to mention any active projects, even if they are stil in the early stages.
Solution 1:
This is a wrapper of my own: https://github.com/AydinAdn/MediaToolkit
MediaToolkit can:
- Convert video files into various other video formats.
- Perform video transcoding tasks.
- Options configurable:
Bit rate
,Frame rate
,Resolution / size
,Aspect ratio
,Duration of video
- Options configurable:
- Perform audio transcoding tasks.
- Options configurable:
Audio sample rate
- Options configurable:
- Convert video to physical formats using FILM, PAL or NTSC tv standards
- Mediums include:
DVD
,DV
,DV50
,VCD
,SVCD
- Mediums include:
I'm updating it as I go along, and you're welcome to use it, you can also install it using the Package Manager Console.
PM> Install-Package MediaToolkit
Solution 2:
After trying several wrappers, I went with this: FFmpeg auto generated unsafe bindings for C#/.NET and Mono.
It's a set of low-level interop bindings for every class in the FFmpeg namespace. Maybe not as convenient to use as an actual wrapper, but IMO it's the best solution for working with FFmpeg in .Net, if you want to do non-trivial things.
Pros:
- Works
- Trustworthy - no 3rd party wrapper code to introduce bugs, assuming you trust FFMpeg itself.
- It's always updated to the latest version of FFmpeg
- Single nuget package for all of the bindings
- XML documentation is included but you still can use the online documentation FFmpeg documentation.
Cons:
- Low level: You have to know how to work with pointers to c structs.
- Requires some work initially to get it working. I suggest to learn from the official examples.
Note: this thread is about using the FFmpeg API, but for some use cases, it's best to simply use ffmpeg.exe's command line interface.
Solution 3:
I have used FFmpeg from a ASP.NET / Windows service (.NET) application. But I ended up using the command-line, without parsing the console. By using this - I had an easy way to control - updates of FFmpeg and running multiple conversions on multiple Cores.
Solution 4:
Try this, I think I might have written something you can use for a simple wrapper.
http://jasonjano.wordpress.com/2010/02/09/a-simple-c-wrapper-for-ffmpeg/
Solution 5:
You can use this nuget package:
I know that you asked about mature project, but i haven't seen any project fullfilling my expectaction so i decided to make my own. You can easily queue conversions and run it parallel, methods to convert media to different formats, send your own arguments to ffmpeg and parse output from ffmpeg + event listener with current progress.
Install-Package Xabe.FFmpeg
I'm trying to make easy to use, cross-platform FFmpeg wrapper.
You can find more information about this at https://xabe.net/product/xabe_ffmpeg/
More info here: https://xabe.net/product/xabe_ffmpeg/#documentation
Conversion is simple:
IConversionResult result = await Conversion.ToMp4(Resources.MkvWithAudio, output).Start();
If you want progress:
IConversion conversion = Conversion.ToMp4(Resources.MkvWithAudio, output);
conversion.OnProgress += (duration, length) => { currentProgress = duration; }
await conversion.Start();