Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET FFmpeg wrapper for video playback [closed]

Looking 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.

like image 991
SharpAffair Avatar asked Jul 16 '11 11:07

SharpAffair


4 Answers

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)!

like image 90
user3103197 Avatar answered Nov 07 '22 15:11

user3103197


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.

like image 28
Dmitry Avatar answered Nov 07 '22 14:11

Dmitry


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.

like image 24
heydmj Avatar answered Nov 07 '22 15:11

heydmj


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.

like image 24
Yaur Avatar answered Nov 07 '22 14:11

Yaur