.NET FFmpeg wrapper for video playback [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
开发者_JAVA技巧 Improve this questionLooking for an FFmpeg wrapper usable in .NET. The wrapper must support video playback with audio.
The following projects are incomplete FFmpeg wrappers:
http://code.google.com/p/ffmpeg-sharp/
http://sourceforge.net/projects/sharpffmpeg/
http://sourceforge.net/projects/ffqlay/
http://www.ffmpeg-csharp.com/
http://www.intuitive.sk/fflib/post/fflib-net-released.aspx
ffmpeg-sharp is the closest thing I've found, but it's also incomplete (no audio in video playback).
I'm quite sure that stable proprietary wrappers do exist, so I will award the bounty to anyone willing to share the code or able to find a complete third-party version.
There is a great solution for binding FFmpeg into C#. Use the FFmpeg.Autogen from: https://github.com/Ruslan-B/FFmpeg.AutoGen. It also provides a good example when downloading the source (and it comes with precompied ffmpeg for 32 and 64 bits)!
From what I know, there's no clean way to utilize ffmpeg from C# via P/Invoke, hence all these wrappers are incomplete projects. What you can do is to create a process to ffplay.exe (download under shared builds) and pass command line arguments to it. Otherwise I suggest using WPF or Silverlight MediaElement, depending on your needs; it has a pretty decent support for majority of basic tasks like video and audio playback.
Have you looked at VLC Media Player yet? It is a full featured media player that uses the codecs from the FFmpeg project. You can make use of it's core functionality and there is a recently updated wrapper project on SourceForge and a tutorial on The Code Project if you want to create your own. I haven't used either of these personally, but they look fairly straight forward to use.
I don't think such a thing exists and frankly the ffmpeg API is still somewhat unstable, so even if there is something today that meets your needs there is a not insignificant chance that 2 years later it will no longer work/be kept up to date. Furthermore, marshaling data between managed and native code is relatively expensive. 99% of the time this doesn't matter, but in the case where you are dealing with media (especially uncompressed video frames) it can have a noticeable performance impact.
IMO the best way to deal with ffmpeg from C# is to write your interaction logic in C and to expose a higher level API that you can p/invoke to from C#. This would still be the case if there was a proper low level wrapper available.
I'm quite sure that stable proprietary wrappers do exist
I spent a good deal of time late last year looking for one myself, without success.
Currently, there is no stable solution for this, so the best idea probably is to wait until someone completes it.
精彩评论