C#环境用dos 命令去执行视频转换怎样才能动态的监视转换的进度呢?望高手赐教!

解决方案 »

  1.   

    试一试  private void execthread() {
                Process nprocess = new Process();
                float duration = 0.00F, current = 0.00F;            nprocess.StartInfo.FileName = Path.Combine(Application.StartupPath, "ffmpeg.exe");
                nprocess.StartInfo.Arguments = @"-i ""C:\myfile.mpg"" -ar 22050 -ab 32 -f flv -s 320×240 -aspect 4:3 -y somemove.flv";
                nprocess.EnableRaisingEvents = false;
                nprocess.StartInfo.UseShellExecute = false;
                nprocess.StartInfo.CreateNoWindow = true;
                nprocess.StartInfo.RedirectStandardOutput = true;
                nprocess.StartInfo.RedirectStandardError = true;
                nprocess.Start();
                StreamReader d = nprocess.StandardError;
                do {
                    string s = d.ReadLine();
                    if (s.Contains("Duration: ")) {
                        string stime = functions.ExtractDuration(s);
                        duration = functions.TotalStringToSeconds(stime);
                        synchTotal(duration.ToString());
                    } else {
                        if (s.Contains("frame=")) {
                            string currents = functions.ExtractTime(s);
                            current = functions.CurrentStringToSeconds(currents);
                            synchCurrent(current.ToString());
                            synchTextOutput(s);
                        }
                    }
                } while (!d.EndOfStream);            nprocess.WaitForExit();
                nprocess.Close();
            }
    参考:
    http://www.hoogervorst.ca/arthur/?p=2009
      

  2.   

    网上有专门的ffmpeg的参数解释.如需要可以传你两份..http://user.qzone.qq.com/20888602/infocenter?ptlang=2052http://user.qzone.qq.com/20888602/infocenter?ptlang=2052