Add robust parsing for force_fps field to handle non-numeric values in video metadata
This commit is contained in:
+12
-1
@@ -127,7 +127,18 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user