mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Also collect duration in ffmpeg media info
This commit is contained in:
parent
3a425c05d9
commit
9c2ba25011
@ -13,8 +13,10 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
public List<FfmpegTrackInfo> Tracks { get; set; }
|
public List<FfmpegTrackInfo> Tracks { get; set; }
|
||||||
|
|
||||||
public Dimension Dimension { get; set; }
|
public Dimension Dimension { get; set; }
|
||||||
|
public TimeCode Duration { get; set; }
|
||||||
|
|
||||||
private static readonly Regex ResolutionRegex = new Regex(@"\d\d+x\d\d+", RegexOptions.Compiled);
|
private static readonly Regex ResolutionRegex = new Regex(@"\d\d+x\d\d+", RegexOptions.Compiled);
|
||||||
|
private static readonly Regex DurationRegex = new Regex(@"Duration: \d+[:\.,]\d+[:\.,]\d+[:\.,]\d+", RegexOptions.Compiled);
|
||||||
|
|
||||||
private FfmpegMediaInfo()
|
private FfmpegMediaInfo()
|
||||||
{
|
{
|
||||||
@ -97,6 +99,13 @@ namespace Nikse.SubtitleEdit.Core.Common
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var match = DurationRegex.Match(line);
|
||||||
|
if (match.Success)
|
||||||
|
{
|
||||||
|
var timeCodeString = match.Value.Split(' ')[1];
|
||||||
|
info.Duration = new TimeCode(TimeCode.ParseToMilliseconds(timeCodeString));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
Loading…
Reference in New Issue
Block a user