【问题标题】:EmguCV/ FFmpeg get video informationEmguCV/FFmpeg 获取视频信息
【发布时间】:2013-10-13 13:33:48
【问题描述】:

如何使用 emguCV 或 FFmpeg 将有关视频文件的信息(例如:每秒帧数、比特率、帧高度、宽度等)获取到 C# 代码。我正在为我的项目使用 C#.net。

【问题讨论】:

    标签: video ffmpeg emgucv


    【解决方案1】:

    也许将 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);
             }
          }
       }
    }
    

    【讨论】:

      猜你喜欢
      • 2023-03-12
      • 2022-12-28
      • 1970-01-01
      • 2019-07-07
      • 1970-01-01
      • 2018-05-17
      • 2012-02-15
      • 2011-10-06
      • 2016-11-25
      相关资源
      最近更新 更多