34

Does anyone know of a set of bindings for C# to drive the FFMpeg library directly ? I could shell to ffmpeg.exe directly but I found it hard to sync/control as a separate process. any help would be appreciated.

MikeJ
  • 14,430
  • 21
  • 71
  • 87

4 Answers4

7

I've seen this library:

ffmpeg-sharp a wrapper library over the FFmpeg multimedia suite that provides easy to use wrappers for use in C#.

Christian C. Salvadó
  • 807,428
  • 183
  • 922
  • 838
5

It's actually pretty easy to control as a separate process. If you redirect StandardOut and StandardError then you can subscribe to the Process.OnData* events and receive the command line output. It's then trivial enough to parse the status line using a regex and work out things like % complete and so on.

The hardest thing is working out what command line to pass to get decent quality! I'd recommend this page and this page if you're using H.264/AAC+.

Greg Beech
  • 133,383
  • 43
  • 204
  • 250
  • Great tip, Greg. Links don't work, so maybe just Google "ffmpeg-x264-encoding-guide" (without the quotes). – Avi Dec 07 '11 at 11:55
  • Too bad there's no option to make it accept / output XML or JSON or something standardized (a few command line apps, like bzr for example, are doing this now, since it makes it easier to automate them). -- Also FFMPEG sometimes updates the same line repeatedly, or inserts newlines and repeats the info non-deterministically... might make it really hard to automate this way. – BrainSlugs83 Aug 04 '14 at 19:59
5

Tao.ffmpeg: http://www.taoframework.com/project/ffmpeg it compiles and has a binary dist which is more than can be said for ffmpeg-sharp at this point. It is, however, not particularly easy to use.

blacktau
  • 169
  • 1
  • 4
  • This one actually works. Unfortunately the function signatures aren't set up for automatic marshalling; expect lots of `IntPtr` parameters. – Roman Starkov Oct 30 '11 at 22:24
  • Unfortunately TAO Framework project is gone. – D.Rosado Jan 04 '12 at 12:40
  • Well, "gone" is not the right word... you can still retrieve all versions from the SF archive [link](http://sourceforge.net/projects/taoframework/files/The%20Tao%20Framework/) – MrCC Jul 08 '14 at 03:48