2013-10-13 70 views

回答

0

可能会发布ffmpeg的ffprobe.exe(来自zeranoe构建)以及您的项目,静默运行并解析其输出?

using System; using System.Diagnostics; using System.Text.RegularExpressions; 
namespace MyClientApp 
{ public class MyApp 
    { public static void Main() 
     { var proc = new Process { StartInfo = new ProcessStartInfo 
     { FileName = "ffprobe.exe",   Arguments = "testvideo.mp4", 
      UseShellExecute = false,   RedirectStandardError = true, CreateNoWindow = true } 
     };  
     proc.Start(); 
     while (!proc.StandardError.EndOfStream) 
     { string line = proc.StandardError.ReadLine(); 
      Match match = Regex.Match(line, @"Video:.*(\d{3,5}x\d{3,5}).*$"); 
      if (match.Success) 
       Console.WriteLine("resolution is: {0}", match.Groups[1].Value); 
     } 
     } 
    } 
} 
+0

谢谢先生! – user1960810