0
如何使用emguCV或FFmpeg获取有关视频文件(例如每秒帧数,比特率,帧高度,宽度等)的信息到C#代码。我为我的项目使用C#.net。EmguCV/FFmpeg获取视频信息
如何使用emguCV或FFmpeg获取有关视频文件(例如每秒帧数,比特率,帧高度,宽度等)的信息到C#代码。我为我的项目使用C#.net。EmguCV/FFmpeg获取视频信息
可能会发布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);
}
}
}
}
谢谢先生! – user1960810