Skip to content

Commit

Permalink
Fixed fps crash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
PeteJobi committed May 31, 2023
1 parent 4a7ccbd commit 443b56a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Upscaler/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void UpscaleFile(string fileName, int currentFileIndex, int totalFilesCount, Act
StartProcess(ffmpegPath, $"-i \"{fileName}\" -qscale:v 1 -qmin 1 -qmax 1 -vsync 0 \"{frameFolders.InputFolder}/frame%08d.png\"", null, (sender, args) =>
{
if (string.IsNullOrWhiteSpace(args.Data)) return;
Console.WriteLine(args.Data);
if (duration == TimeSpan.MinValue)
{
MatchCollection matchCollection = Regex.Matches(args.Data, @"\s+?Duration:\s(\d{2}:\d{2}:\d{2}\.\d{2}).+");
Expand All @@ -120,8 +121,8 @@ void UpscaleFile(string fileName, int currentFileIndex, int totalFilesCount, Act
}
else if (fps == null) //fps information should come immediately after the duration line
{
MatchCollection matchCollection = Regex.Matches(args.Data, @"(\d+.\d+)\sfps");
if (matchCollection.Count == 0) throw new ArgumentException("FPS information not found");
MatchCollection matchCollection = Regex.Matches(args.Data, @"(\d+.?\d+)\sfps");
if (matchCollection.Count == 0) return;
fps = matchCollection[0].Groups[1].Value;
}
else
Expand Down

0 comments on commit 443b56a

Please sign in to comment.