Add 320p, 384p, and 900p size presets to Clone-Video.ps1 with aspect-ratio-preserving scaling logic, add -Sideways parameter to Compare-Videos.ps1 for single-row layouts with optional -Clip support, extend -Clip to portrait 2-4 video layouts, and add corresponding crop filters to Crop-Clips.ps1
This commit is contained in:
+23
-2
@@ -22,7 +22,11 @@
|
||||
Path to PNG file for extracted frame. Can be absolute or relative to current directory. .png extension is added if not provided. If EndFrame is -1, extracts the last frame and excludes it from the cloned video. If EndFrame is not -1, extracts the frame at EndFrame index and excludes it from the cloned video.
|
||||
.PARAMETER Size
|
||||
Size of the output video. Uses the input video's size if not specified.
|
||||
Possible values: 480p, 720p, 1080p, HD, 1440p, 2K, 2160p, 4K, or custom size in format "width:height".
|
||||
Possible values: 320p, 384p, 480p, 720p, 900p, 1080p, HD, 1440p, 2K, 2160p, 4K, or custom size in format "width:height".
|
||||
For standard named sizes the output preserves the source's aspect ratio: the reference
|
||||
height is used as the short-side target and the other dimension is computed from the
|
||||
source AR (landscape/square: target height = reference, width computed; portrait: target
|
||||
width = reference, height computed). Custom sizes (width:height) are applied exactly.
|
||||
Forces a video re-encode, since scaling requires re-encoding.
|
||||
.PARAMETER FPS
|
||||
Frames per second for the output video. Uses the input video's FPS if not specified.
|
||||
@@ -203,8 +207,11 @@ if (-not [string]::IsNullOrWhiteSpace($Audio)) {
|
||||
}
|
||||
|
||||
$sizeMap = @{
|
||||
'320p' = @{ Width = 570; Height = 320 }
|
||||
'384p' = @{ Width = 684; Height = 384 }
|
||||
'480p' = @{ Width = 854; Height = 480 }
|
||||
'720p' = @{ Width = 1280; Height = 720 }
|
||||
'900p' = @{ Width = 1600; Height = 900 }
|
||||
'1080p' = @{ Width = 1920; Height = 1080 }
|
||||
'HD' = @{ Width = 1920; Height = 1080 }
|
||||
'1440p' = @{ Width = 2560; Height = 1440 }
|
||||
@@ -215,16 +222,18 @@ $sizeMap = @{
|
||||
|
||||
$scaleWidth = 0
|
||||
$scaleHeight = 0
|
||||
$standardSizeHeight = 0
|
||||
|
||||
if (-not [string]::IsNullOrWhiteSpace($Size)) {
|
||||
if ($sizeMap.ContainsKey($Size)) {
|
||||
$scaleWidth = $sizeMap[$Size].Width
|
||||
$scaleHeight = $sizeMap[$Size].Height
|
||||
$standardSizeHeight = $sizeMap[$Size].Height
|
||||
} elseif ($Size -match '^(\d+):(\d+)$') {
|
||||
$scaleWidth = [int]$Matches[1]
|
||||
$scaleHeight = [int]$Matches[2]
|
||||
} else {
|
||||
Write-Error ('Invalid Size value: {0}. Possible values: 480p, 720p, 1080p, HD, 1440p, 2K, 2160p, 4K, or custom size in format "width:height".' -f $Size)
|
||||
Write-Error ('Invalid Size value: {0}. Possible values: 320p, 384p, 480p, 720p, 900p, 1080p, HD, 1440p, 2K, 2160p, 4K, or custom size in format "width:height".' -f $Size)
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
@@ -287,6 +296,18 @@ if ($LASTEXITCODE -eq 0) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($standardSizeHeight -gt 0 -and -not $LTX -and $sourceWidth -gt 0 -and $sourceHeight -gt 0) {
|
||||
if ($sourceWidth -ge $sourceHeight) {
|
||||
$scaleHeight = $standardSizeHeight
|
||||
$scaleWidth = [int][Math]::Round([double]$sourceWidth * $standardSizeHeight / $sourceHeight)
|
||||
if ($scaleWidth % 2) { $scaleWidth++ }
|
||||
} else {
|
||||
$scaleWidth = $standardSizeHeight
|
||||
$scaleHeight = [int][Math]::Round([double]$sourceHeight * $standardSizeHeight / $sourceWidth)
|
||||
if ($scaleHeight % 2) { $scaleHeight++ }
|
||||
}
|
||||
}
|
||||
|
||||
if ($LTX) {
|
||||
$ltxKey = $Size
|
||||
if ($ltxKey -eq 'HD') { $ltxKey = '1080p' }
|
||||
|
||||
Reference in New Issue
Block a user