/**/
/// <summary>
/// 将视频文件转换
/// </summary>
/// <param name="sourceFile">要转换的文件</param>
/// <returns></returns>
public bool Convert(string sourceFile, string qscale, string suffix, VideoType type)
{
try
{ System.Diagnostics.Process p = new System.Diagnostics.Process();//建立外部调用线程
p.StartInfo.FileName = "C:\\ffmpeg.exe";//要调用外部程序的绝对路径
p.StartInfo.Arguments = "";//参数(这里就是FFMPEG的参数了)
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动线程(一定为FALSE,详细的请看MSDN)
p.StartInfo.RedirectStandardError = true;//把外部程序错误输出写到StandardError流中(这个一定要注意,FFMPEG的所有输出信息,都为错误输出流,用StandardOutput是捕获不到任何消息的...这是我耗费了2个多月得出来的经验...mencoder就是用standardOutput来捕获的)
p.StartInfo.CreateNoWindow = false;//不创建进程窗口
p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(Output);//外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
p.Start();//启动线程
p.BeginErrorReadLine();//开始异步读取
p.WaitForExit();//阻塞等待进程结束
p.Close();//关闭进程
p.Dispose();//释放资源 //string allErrorMessage = ?? 我在这里如何得到Output 里面的所有 ouput.Data 的值呢
//也就相当于在这里取得那个ErrorDataReceived的所有信息
//谢谢
return true;
}
catch (Exception exp)
{
throw exp;
}
}
private void Output(object sendProcess, System.Diagnostics.DataReceivedEventArgs output)
{
if (!String.IsNullOrEmpty(output.Data))
{
//处理方法...
string message = output.Data;
Console.WriteLine(message);
}
}
/// <summary>
/// 将视频文件转换
/// </summary>
/// <param name="sourceFile">要转换的文件</param>
/// <returns></returns>
public bool Convert(string sourceFile, string qscale, string suffix, VideoType type)
{
try
{ System.Diagnostics.Process p = new System.Diagnostics.Process();//建立外部调用线程
p.StartInfo.FileName = "C:\\ffmpeg.exe";//要调用外部程序的绝对路径
p.StartInfo.Arguments = "";//参数(这里就是FFMPEG的参数了)
p.StartInfo.UseShellExecute = false;//不使用操作系统外壳程序启动线程(一定为FALSE,详细的请看MSDN)
p.StartInfo.RedirectStandardError = true;//把外部程序错误输出写到StandardError流中(这个一定要注意,FFMPEG的所有输出信息,都为错误输出流,用StandardOutput是捕获不到任何消息的...这是我耗费了2个多月得出来的经验...mencoder就是用standardOutput来捕获的)
p.StartInfo.CreateNoWindow = false;//不创建进程窗口
p.ErrorDataReceived += new System.Diagnostics.DataReceivedEventHandler(Output);//外部程序(这里是FFMPEG)输出流时候产生的事件,这里是把流的处理过程转移到下面的方法中,详细请查阅MSDN
p.Start();//启动线程
p.BeginErrorReadLine();//开始异步读取
p.WaitForExit();//阻塞等待进程结束
p.Close();//关闭进程
p.Dispose();//释放资源 //string allErrorMessage = ?? 我在这里如何得到Output 里面的所有 ouput.Data 的值呢
//也就相当于在这里取得那个ErrorDataReceived的所有信息
//谢谢
return true;
}
catch (Exception exp)
{
throw exp;
}
}
private void Output(object sendProcess, System.Diagnostics.DataReceivedEventArgs output)
{
if (!String.IsNullOrEmpty(output.Data))
{
//处理方法...
string message = output.Data;
Console.WriteLine(message);
}
}
解决方案 »
- 在aspx.cs页面对控件进行了扩展,在aspx页面中如何调用扩展后的控件?
- 都进来看看这里有两个超级简单的问题
- 为什么我的网站在本地可以正常运行,放到服务器中就不可以呢?
- frameset 的问题
- 怎么在客户段控制datagird 中的checkbox列中点击header中的一个实现全选和全取消啊
- ====83年的CSDN上的朋友加这个群啊共同学习ASP。NET和C#大家一起交流啊====
- 两个常见问题
- count(*) AS count 是什么意思??? 菜鸟请教!
- (路过的请进来)能不能告诉我常用的whois服务器
- 我的sql server2k中有一个datetime的字段,请问如何在程序把当前时间减去一天加入库里呢。
- 怎样从 .cs 文件里调用 jQuery的弹出层对话框?
- 大侠们,请教一个简单问题,速来解决!很急……
string message = output.ToString();