标签:current shel cut indexof .exe new 异步 using ffmpeg
使用ffmpeg.exe获取文件属性信息,C#中可以在进程外异步调用这个工具,如下:
using (System.Diagnostics.Process pro = new System.Diagnostics.Process()) { pro.StartInfo.UseShellExecute = false; pro.StartInfo.ErrorDialog = false; pro.StartInfo.RedirectStandardError = true; pro.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "ffmpeg.exe"; pro.StartInfo.Arguments = " -i " + fileName; pro.Start(); System.IO.StreamReader errorreader = pro.StandardError; pro.WaitForExit(1000); string result = errorreader.ReadToEnd(); if (!string.IsNullOrEmpty(result)) { result = result.Substring(result.IndexOf("Duration: ") + ("Duration: ").Length, ("00:00:00").Length); duration = result; } }
标签:current shel cut indexof .exe new 异步 using ffmpeg
原文地址:http://www.cnblogs.com/EasonJim/p/6255737.html