是否可以实时将 wma 流转换为 mp3 流?
我试过做这样的事情,但没有任何运气:
WebRequest request = WebRequest.Create(wmaUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
int block = 32768;
byte[] buffer = new byte[block];
Process p = new Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.ErrorDialog = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.FileName = "c:\\ffmpeg.exe";
p.StartInfo.Arguments = "-i - -y -vn -acodec libspeex -ac 1 -ar 16000 -f mp3 ";
StringBuilder output = new StringBuilder();
p.OutputDataReceived += (sender, e) =>
{
if (e.Data != null)
{
output.AppendLine(e.Data);
//eventually replace this with response.write code for a web request
}
};
p.Start();
StreamWriter ffmpegInput = p.StandardInput;
p.BeginOutputReadLine();
using (Stream dataStream = response.GetResponseStream())
{
int read = dataStream.Read(buffer, 0, block);
while (read > 0)
{
ffmpegInput.Write(buffer);
ffmpegInput.Flush();
read = dataStream.Read(buffer, 0, block);
}
}
ffmpegInput.Close();
var getErrors = p.StandardError.ReadToEnd();
只是想知道我想要做的事情是否可能(将 wma 的字节块转换为 mp3 的字节块)。对任何其他可能的 C# 解决方案(如果存在)开放。
谢谢