在网上看到一个段代码 是调用这几个函数把视频转成FLV格式
RunFFMpeg 是传个字符串STR 然后调用ffmpeg.exe执行" -i " + strCmd参数
FFMPEG.EXE是什么可 RunCmd这个函数传什么参数就不知道了
而且 这个好像是CS结构的吧 ASP.NET不行了吧 string str=@"d:\test.avi d:\test_allen.flv";
RunFFMpeg(str); //运行FFMpeg的视频解码,
public void RunFFMpeg(string strCmd)
{
//创建并启动一个新进程
Process p = new Process();
//设置进程启动信息属性StartInfo,这是ProcessStartInfo类,包括了一些属性和方法:
p.StartInfo.FileName = "ffmpeg.exe"; //程序名
p.StartInfo.Arguments = " -i " + strCmd; //执行参数
p.Start();
}
//运行Cmd.exe执行Dos 命令,并返回执行结果
public string RunCmd(string command)
{
//创建并启动一个对进程
Process p = new Process();
//Process类有一个StartInfo属性,这是ProcessStartInfo类,包括了一些属性和方法,例如:
p.StartInfo.FileName = "cmd.exe"; //程序名
p.StartInfo.Arguments = " /c " + command; //执行参数
p.StartInfo.UseShellExecute = false; //关闭Shell的使用
p.StartInfo.RedirectStandardInput = true; //重定向标准输入
p.StartInfo.RedirectStandardOutput = true; //重定向标准输出
p.StartInfo.RedirectStandardError = true; //重定向错误输出
p.StartInfo.CreateNoWindow = true; //设置不显示窗口
p.Start();
//p.StandardInput.WriteLine(command); //也可以用這種方式輸入要執行的命令
//p.StandardInput.WriteLine("exit"); //不過要記得加上Exit要不然下一行程式執行的時候會當機
//必须创建可以自动转换完成以后,结束进程的代码
return p.StandardOutput.ReadToEnd(); //從輸出流取得命令執行結果
}
RunFFMpeg 是传个字符串STR 然后调用ffmpeg.exe执行" -i " + strCmd参数
FFMPEG.EXE是什么可 RunCmd这个函数传什么参数就不知道了
而且 这个好像是CS结构的吧 ASP.NET不行了吧 string str=@"d:\test.avi d:\test_allen.flv";
RunFFMpeg(str); //运行FFMpeg的视频解码,
public void RunFFMpeg(string strCmd)
{
//创建并启动一个新进程
Process p = new Process();
//设置进程启动信息属性StartInfo,这是ProcessStartInfo类,包括了一些属性和方法:
p.StartInfo.FileName = "ffmpeg.exe"; //程序名
p.StartInfo.Arguments = " -i " + strCmd; //执行参数
p.Start();
}
//运行Cmd.exe执行Dos 命令,并返回执行结果
public string RunCmd(string command)
{
//创建并启动一个对进程
Process p = new Process();
//Process类有一个StartInfo属性,这是ProcessStartInfo类,包括了一些属性和方法,例如:
p.StartInfo.FileName = "cmd.exe"; //程序名
p.StartInfo.Arguments = " /c " + command; //执行参数
p.StartInfo.UseShellExecute = false; //关闭Shell的使用
p.StartInfo.RedirectStandardInput = true; //重定向标准输入
p.StartInfo.RedirectStandardOutput = true; //重定向标准输出
p.StartInfo.RedirectStandardError = true; //重定向错误输出
p.StartInfo.CreateNoWindow = true; //设置不显示窗口
p.Start();
//p.StandardInput.WriteLine(command); //也可以用這種方式輸入要執行的命令
//p.StandardInput.WriteLine("exit"); //不過要記得加上Exit要不然下一行程式執行的時候會當機
//必须创建可以自动转换完成以后,结束进程的代码
return p.StandardOutput.ReadToEnd(); //從輸出流取得命令執行結果
}
Process p = new Process();
p.StartInfo.FileName = "ffmpeg.exe";
p.StartInfo.Arguments = " -i " + "";
p.Start();
参考http://www.cnblogs.com/weichuo/archive/2008/11/21/1338298.html
大侠帮帮忙