'Export converted video into stream using ffmpeg pipe option

I'm stream and successfully output converted video into mkv file.

var stream = ..incoming stream of type MemoryStream();
var process = new System.Diagnostics.Process();
process.StartInfo.Arguments = "-f mp4 -i pipe:0 -c:v libx264 -crf 20 -s 600:400 -f matroska myfile.mkv";
process.Start();
process.StandardInput.BaseStream.Write(stream.ToArray())
process.BeginOutputReadLine()
process.StandardInput.BaseStream.Close();
process.WaitForExit(1000);

My question is: how can I change the implementation (command and StandardOutput.BaseStream in order to export results into memory stream and not file (like it's in the above example).



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source