2013-10-13 69 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