From 5bf1b5caaeed09f78315ccdb4c723d5a18969138 Mon Sep 17 00:00:00 2001 From: Claude Toupin Date: Sun, 31 May 2026 21:02:37 -0400 Subject: [PATCH] Add robust parsing for force_fps field to handle non-numeric values in video metadata --- Get-VideoInfo.ps1 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Get-VideoInfo.ps1 b/Get-VideoInfo.ps1 index ea7a411..03aea01 100644 --- a/Get-VideoInfo.ps1 +++ b/Get-VideoInfo.ps1 @@ -127,9 +127,20 @@ try { $fieldExists = $parsedComment.PSObject.Properties.Name -contains 'force_fps' if ($fieldExists) { - $fps = [double]$parsedComment.force_fps + # force_fps may be a number (e.g. 30) or a non-numeric mode string + # (e.g. "control" in some WanGP/LTX presets). Only override the + # default when the value parses as a positive number. + $forceFpsRaw = $parsedComment.force_fps + $parsedFps = 0.0 + if ([double]::TryParse( + [string]$forceFpsRaw, + [System.Globalization.NumberStyles]::Float, + [System.Globalization.CultureInfo]::InvariantCulture, + [ref]$parsedFps) -and $parsedFps -gt 0) { + $fps = $parsedFps + } } - + $frames = [int]$fieldValue $secondsAt24fps = [Math]::Round($frames / $fps, 1) $valueDisplay = ('{0} frames ({1}s, {2} fps)' -f $frames, $secondsAt24fps, $fps)