OK, I wrote the following code to do this:
Process ffmpeg = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "ffmpeg.exe",
Arguments = "-i audio.mp3 -f flac -",
UseShellExecute = false,
RedirectStandardOutput = true,
WindowStyle = ProcessWindowStyle.Hidden
}
};
Process oggenc2 = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "oggenc2.exe",
Arguments = "- -o audio.ogg",
UseShellExecute = false,
RedirectStandardInput = true,
WindowStyle = ProcessWindowStyle.Hidden
}
};
ffmpeg.Start();
oggenc2.Start();
int bufferLength = 4096;
var input = oggenc2.StandardInput.BaseStream;
var output = ffmpeg.StandardOutput.BaseStream;
using (BinaryWriter writer = new BinaryWriter(input))
{
using (BinaryReader r = new BinaryReader(output))
{
byte[] buffer = new byte[bufferLength];
int bytesRead;
do
{
bytesRead = r.Read(buffer, 0, bufferLength);
writer.Write(buffer, 0, bytesRead);
} while (bytesRead > 0);
}
}
ffmpeg.WaitForExit();
Hope, this helps.