码迷,mamicode.com
首页 > Windows程序 > 详细

C# FFmpeg获取码率

时间:2015-06-29 19:18:23      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

GetInfo("ffmpeg"," -i "+sourcename);               

  static void GetInfo (string exe,string arg)

{
Process p = new Process (); 
try
{
p.StartInfo.FileName = exe;
p.StartInfo.Arguments = arg;
p.StartInfo.UseShellExecute = false;    
p.StartInfo.CreateNoWindow = true;  
p.StartInfo.RedirectStandardError = true ;
//启动进程
p.Start();
//等待进程结束
p.WaitForExit();
string Errorstr = p.StandardError.ReadToEnd();
string ss1 = "bitrate:";
string ss2 = "kb/s";
string kbps =  Errorstr.Remove(0,Errorstr.IndexOf(ss1)+ss1.Length);
string kbpsstr = kbps.Substring(0,kbps.IndexOf(ss2));
bitratestr = kbpsstr.Trim();
Console.WriteLine("码率:"+bitratestr);
p.Close();         
}
catch(Exception ex) {
Console.WriteLine (ex.Message);
}
finally {


}
}

C# FFmpeg获取码率

标签:

原文地址:http://www.cnblogs.com/liwb1987/p/4607829.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!