I'm trying to create a .NET wrapper for media-file conversion using ffmepg, here is what I've tried:
static void Main(string[] args)
{
if (File.Exists("sample.mp3")) File.Delete("sample.mp3");
string result;
using (Process p = new Process())
{
p.StartInfo.FileName = "ffmpeg";
p.StartInfo.Arguments = "-i sample.wma sample.mp3";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
//result is assigned with an empty string!
result = p.StandardOutput.ReadToEnd();
p.WaitForExit();
}
}
What actually happens is the content of the ffmpeg program is printed out to the Console app, but the result
variable is an empty string. I want to control the conversion progress interactively, so the user doesn't even have to know I'm using ffmpeg, but he still knows the conversion progress' details and what percentage etc. the app is up to.
Basically I would also be happy with a .NET wrapper for a P/Invoke to conversion function ONLY (I am not interested in a whole external library, unless I can extract the PI function from it).
Anyone with experience in ffmpeg & .NET?
Update Please view my further question, how to write input to a running ffmpeg process.
Here is the answer:
Try using ffmpeg-sharp.