title: Using FFmpeg in .net?
body: <p>So I know its a fairly big challenge but I want to write a basic movie player/converter in c# using the FFmpeg library. However, the first obstacle I need to overcome is wrapping the FFmpeg library in c#. I've downloaded ffmpeg but couldn't compile it on Windows, so I downloaded a precompiled version for me. Ok awesome. Then I started looking for C# wrappers.</p>
  
  <p>I have looked around and have found a few wrappers such as SharpFFmpeg (<a href="http://sourceforge.net/projects/sharpffmpeg/" rel="noreferrer">http://sourceforge.net/projects/sharpffmpeg/</a>) and ffmpeg-sharp (<a href="http://code.google.com/p/ffmpeg-sharp/" rel="noreferrer">http://code.google.com/p/ffmpeg-sharp/</a>). First of all, I wanted to use ffmpeg-sharp as its LGPL and SharpFFmpeg is GPL. However, it had quite a few compile errors. Turns out it was written for the mono compiler, I tried compiling it with mono but couldn't figure out how. I then started to manually fix the compiler errors myself, but came across a few scary ones and thought I'd better leave those alone. So I gave up on ffmpeg-sharp.</p>
  
  <p>Then I looked at SharpFFmpeg and it looks like what I want, all the functions P/Invoked for me. However its GPL? Both the AVCodec.cs and AVFormat.cs files look like ports of avcodec.c and avformat.c which I reckon I could port myself? Then not have to worry about licencing.</p>
  
  <p>But I want to get this right before I go ahead and start coding. Should I:</p>
  
  <ol>
  <li>Write my own C++ library for interacting with ffmpeg, then have my C# program talk to the C++ library in order to play/convert videos etc.</li>
  </ol>
  
  <p>OR</p>
  
  <ol start="2">
  <li>Port avcodec.h and avformat.h (is that all i need?) to c# by using a whole lot of DllImports and write it entirely in C#?</li>
  </ol>
  
  <p>First of all consider that I'm not great at C++ as I rarely use it but I know enough to get around. The reason I'm thinking #1 might be the better option is that most FFmpeg tutorials are in C++ and I'd also have more control over memory management than if I was to do it in c#.</p>
  
  <p>What do you think?
  Also would you happen to have any useful links (perhaps a tutorial) for using FFmpeg?</p>