16

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.

Malavos
  • 429
  • 3
  • 12
  • 27
SharpAffair
  • 5,558
  • 13
  • 78
  • 158

6 Answers6

7

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

user3103197
  • 79
  • 1
  • 1
  • 1
    I've used Ruslan's FFmpeg wrapper myself and it's so far the best I have found. If you need audio and video playback try my implementation of MediaElement (using AutoGen). The source code is available here: https://github.com/unosquare/ffmediaelement – Mario Jan 27 '16 at 23:48
3

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.

Dmitry
  • 73
  • 1
  • 8
2

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.

heydmj
  • 106
  • 1
  • 5
  • 1
    1. VLC package is way too big. 2. It needs to be installed in order to work properly (same thing as installing codecs). – SharpAffair Jul 16 '11 at 22:38
1

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.

Yaur
  • 7,333
  • 1
  • 25
  • 36
-1

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.

quentin-starin
  • 26,121
  • 7
  • 68
  • 86
-4

Currently, there is no stable solution for this, so the best idea probably is to wait until someone completes it.

SharpAffair
  • 5,558
  • 13
  • 78
  • 158