var arg = "-i \"" + filepath + "\" 2"; TimeSpan duration = TimeSpan.Zero; await FFMpeg.Xamarin.FFmpegLibrary.Run(this.BaseContext, arg, (line) => { System.Diagnostics.Debug.WriteLine("ffmpeg output:" + line); var regex = new Regex(@"Duration: (\d+):(\d\d):(\d\d)\.(\d+)"); var match = regex.Match(line); if (match.Success) { var hours = int.Parse(match.Groups[1].Value); var minutes = int.Parse(match.Groups[2].Value); var seconds = int.Parse(match.Groups[3].Value); var milliseconds = int.Parse(match.Groups[4].Value) * 10; duration = new TimeSpan(0, hours, minutes, seconds, milliseconds); } });
标签:ffmpeg,c#,音频,Value,Parse,int,Groups,var,match From: https://www.cnblogs.com/nanfei/p/17961655