Rename -Source parameter to -Video in Create-Clip.ps1 and Create-PillarBox.ps1 for consistency with other scripts, updating all internal variable names (sourcePath->videoPath, sourceFull->videoFull) and documentation references, while preserving .skip marker handling and parameter forwarding logic in Create-Clip.ps1 and maintaining default -Target derivation and effect naming in Create-PillarBox.ps1

This commit is contained in:
guru committed 2026-10-31 00:20:02 -04:00
1 parent c8c5a5d75c
commit 553d0ea18d
3 files changed
+32 -32

No files matched your search

+13 -13
View File
@@ -1,7 +1,7 @@
<#
.SYNOPSIS
Creates a pillar-boxed video file from a video file.
.PARAMETER Source
.PARAMETER Video
Path to the input video file. Can be absolute or relative to current directory. .mp4 extension is added if not provided.
.PARAMETER Target
Path to the output video file. Can be absolute or relative to current directory. .mp4 extension is added if not provided.
@@ -45,7 +45,7 @@
[CmdletBinding(SupportsShouldProcess)]
param(
[Parameter(Mandatory = $true)]
[string]$Source,
[string]$Video,
[Parameter(Mandatory = $false)]
[string]$Target = $null,
@@ -247,25 +247,25 @@ elseif ($effectLower -notin $validEffects) {
throw "Invalid -Effect value: $Effect. Must be one of: $($validEffects -join ', '), or 'color:RRGGBB' (6 hex digits)."
}
# Append .mp4 extension if missing on -Source
if (-not [System.IO.Path]::GetExtension($Source)) {
$Source = "$Source.mp4"
# Append .mp4 extension if missing on -Video
if (-not [System.IO.Path]::GetExtension($Video)) {
$Video = "$Video.mp4"
}
if (-not (Test-Path -LiteralPath $Source)) {
throw "Source video not found: $Source"
if (-not (Test-Path -LiteralPath $Video)) {
throw "Video file not found: $Video"
}
$sourceFull = (Resolve-Path -LiteralPath $Source).Path
$videoFull = (Resolve-Path -LiteralPath $Video).Path
# Default -Target: same directory and base name as -Source, with the effect appended
# Default -Target: same directory and base name as -Video, with the effect appended
# (e.g. C:\clips\video.mp4 + -Effect Black -> C:\clips\video-black.mp4).
# For 'color:RRGGBB', the colon is replaced with a dash to keep the filename valid
# (e.g. -Effect color:FFFF00 -> video-color-ffff00.mp4).
# With -Vertical, '-vertical' is appended last (e.g. video-black-vertical.mp4).
if ([string]::IsNullOrWhiteSpace($Target)) {
$srcDir = [System.IO.Path]::GetDirectoryName($sourceFull)
$srcBase = [System.IO.Path]::GetFileNameWithoutExtension($sourceFull)
$srcDir = [System.IO.Path]::GetDirectoryName($videoFull)
$srcBase = [System.IO.Path]::GetFileNameWithoutExtension($videoFull)
$effectForName = $effectLower -replace ':', '-'
$verticalForName = if ($Vertical) { '-vertical' } else { '' }
$Target = Join-Path $srcDir "$srcBase-$effectForName$verticalForName.mp4"
@@ -296,7 +296,7 @@ if ($CRF -ne -1 -and ($CRF -lt 0 -or $CRF -gt 51)) {
throw "Invalid -CRF value: $CRF. Must be in range 0-51."
}
$inInfo = Get-VideoInfo -Path $sourceFull
$inInfo = Get-VideoInfo -Path $videoFull
$inRes = "{0}x{1}" -f $inInfo.Width, $inInfo.Height
$inFpsText = if ($inInfo.Fps) { "{0:0.###}" -f $inInfo.Fps } else { 'unknown' }
@@ -370,7 +370,7 @@ $effFps = if ($FPS -gt 0) { $FPS } elseif ($inInfo.Fps) { $inInfo.Fps } else { $
$effFpsText = if ($effFps) { "{0:0.###}" -f $effFps } else { 'unknown' }
# Build ffmpeg arguments
$ffArgs = @('-y', '-i', $sourceFull)
$ffArgs = @('-y', '-i', $videoFull)
if ($audioFull) {
$ffArgs += @('-i', $audioFull)