views:

211

answers:

2

Hi, Is it possible to convert an AVI file to 3gp in C# ? If so how could I do this? Any ideas will be appreciated, thanks in advance.

A: 

There is no really easy way to do it; my advice is to use ffmpeg, either through the use of a C# wrapper of by calling it externally. There seem to be several C# wrappers for ffmpeg (like this one) but they all seem to be in various stages of development and not really usable. Your only option is likely going to be by calling it externally.

TkTech
ffmpeg-sharp is incomplete and old. Have you had any success with it? I've found Tao to be a bit better, but ended up directly calling it through a C++/CLI wrapper.
Robert Fraser
It was essentially useless for most things - like I advised, I ended up using the system ffmpeg and piping to/from. Less control but enough for a simple conversion between container formats.
TkTech
+4  A: 

It depends what you mean by "convert". Both 3GP and AVI are wrapper formats, so are you merely trying to change the container format, or do you want to re-encode the streams as well?

Either way, you should probably take a look at ffmpeg (Windows info). For simple cases (i.e. you have the file, want a single output file), you should probably consider it invoking it on the command-line (i.e. System.Diagnostics.Process), which is much easier (and doesn't involve any licensing issues). If you want to access libavcodec/libavormat programatically, I highly recommend skipping any .NET wrapper libs (they all are in different states of sucking; Tao being the best but that's not saying much) and instead writing a C++/CLI wrapper. I started doing this, and once I got my head around data marshalling, etc., and figured out how to build it (Part 1, Part 2), it wasn't too hard.

Robert Fraser