是这样的,我用ffmpeg.exe把视频转换成flv格式,没报错
但是不知道为什么,每次转换出来的文件都是0kb,不管原文件是多少kb或m都是这样代码:
public bool VideoConvertFlv(string fileBeginConvertName, string WidthAndHeight)
{
string fileSaveUrl = fileBeginConvertName.Substring( 0, fileBeginConvertName.LastIndexOf(@"\") )+"\\";//获取fileSave路径
string fileEndConvertName =@" "+ fileSaveUrl + DateTime.Now.ToLongDateString() + ".flv"; Process p = new Process();
p.StartInfo.FileName = fileSaveUrl + "ffmpeg.exe";
p.StartInfo.Arguments = " -i " + fileBeginConvertName + fileEndConvertName;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = false;
p.ErrorDataReceived += new DataReceivedEventHandler(Output);
p.Start();
p.BeginErrorReadLine();
p.WaitForExit();
p.Close();
p.Dispose();
return true;
}
private void Output(object sendProcess, DataReceivedEventArgs output)
{
}
但是不知道为什么,每次转换出来的文件都是0kb,不管原文件是多少kb或m都是这样代码:
public bool VideoConvertFlv(string fileBeginConvertName, string WidthAndHeight)
{
string fileSaveUrl = fileBeginConvertName.Substring( 0, fileBeginConvertName.LastIndexOf(@"\") )+"\\";//获取fileSave路径
string fileEndConvertName =@" "+ fileSaveUrl + DateTime.Now.ToLongDateString() + ".flv"; Process p = new Process();
p.StartInfo.FileName = fileSaveUrl + "ffmpeg.exe";
p.StartInfo.Arguments = " -i " + fileBeginConvertName + fileEndConvertName;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = false;
p.ErrorDataReceived += new DataReceivedEventHandler(Output);
p.Start();
p.BeginErrorReadLine();
p.WaitForExit();
p.Close();
p.Dispose();
return true;
}
private void Output(object sendProcess, DataReceivedEventArgs output)
{
}
换个视频就可以了,真是......被搞死了