我想在程序里面调用mencoder将视频转换成avi格式.现在程序可以运行,但是很奇怪的就是mencoder转换到一半就停下来,在进程里面显示cpu使用为0,等待很久也没有反应. 强行结束进程以后发现视频转换了一半,已经转换的部分可以正常观看.这是什么原因造成的啊? 望高手指点!
 
       public void ConvertVideoToAVI(string MencoderPath, string MencoderParam)
        {
                ProcessStartInfo psi = new ProcessStartInfo( MencoderPath + "mencoder.exe" ) ;
                psi.Arguments = MencoderParam;
                psi.WorkingDirectory = MencoderPath;
                psi.UseShellExecute = false;//不使用操作系统外壳程序启动线程
                psi.RedirectStandardError = true;//把外部程序错误输出写到StandardError流中
                psi.CreateNoWindow = false;//不创建进程窗口
                psi.RedirectStandardInput = true;   //重定向
                psi.RedirectStandardOutput = true;                Process p = new Process();//建立外部调用线程
                p.StartInfo = psi;
                p.OutputDataReceived += new DataReceivedEventHandler(Output);//mecoder输出流时候把流的处理过程转移到Output
                
                p.Start();//启动线程
                p.BeginOutputReadLine();//开始异步读取
                if (p.WaitForExit(300000) == false) //设置等待时间限制
                {
                    if (p.HasExited == false)
                    {
                        p.Kill();
                        p.WaitForExit();//阻塞等待进程完成
                        //   }                    }
                }               // p.WaitForExit();//阻塞等待进程完成                p.Close();//关闭进程
                p.Dispose();//释放资源
        
        }