Skip to content

Commit c647c56

Browse files
committed
fix: Correct string quotes in Trim-VideoWithFFMpeg.ps1 for consistency
1 parent ea0b146 commit c647c56

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

VideoAndAudio/Trim-VideoWithFFMpeg.ps1

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ function Get-TimeInHHMMSSFormat {
2121
1 { return [TimeSpan]::FromSeconds([int]$timeParts[0]) }
2222
2 { return [TimeSpan]::FromMinutes([int]$timeParts[0]).Add([TimeSpan]::FromSeconds([int]$timeParts[1])) }
2323
3 { return [TimeSpan]::FromHours([int]$timeParts[0]).Add([TimeSpan]::FromMinutes([int]$timeParts[1])).Add([TimeSpan]::FromSeconds([int]$timeParts[2])) }
24-
default { throw "Invalid time format. Please use one of the following formats: SS, MM:SS, or HH:MM:SS." }
24+
default { throw 'Invalid time format. Please use one of the following formats: SS, MM:SS, or HH:MM:SS.' }
2525
}
2626
}
2727

2828
# Get video duration using FFmpeg
29-
$duration = & ffmpeg -i $InputVideo 2>&1 | Select-String -Pattern "Duration: (\d+):(\d+):(\d+\.\d+)" | ForEach-Object { $_.Matches.Groups[1].Value, $_.Matches.Groups[2].Value, $_.Matches.Groups[3].Value -join ":" }
29+
$duration = & ffmpeg -i $InputVideo 2>&1 | Select-String -Pattern 'Duration: (\d+):(\d+):(\d+\.\d+)' | ForEach-Object { $_.Matches.Groups[1].Value, $_.Matches.Groups[2].Value, $_.Matches.Groups[3].Value -join ':' }
3030

3131
# Use the custom Parse-Time function
3232
$startCutTimeSpan = Get-TimeInHHMMSSFormat -Time $StartCut
@@ -43,7 +43,7 @@ $endCutTimeSpan = Get-TimeInHHMMSSFormat -Time $EndCut
4343
$newDuration = $endCutTimeSpan.Subtract($startCutTimeSpan)
4444

4545
# Format new duration for FFmpeg
46-
$newDuration = "{0:00}:{1:00}:{2:00}.{3:000}" -f $newDuration.Hours, $newDuration.Minutes, $newDuration.Seconds, $newDuration.Milliseconds
46+
$newDuration = '{0:00}:{1:00}:{2:00}.{3:000}' -f $newDuration.Hours, $newDuration.Minutes, $newDuration.Seconds, $newDuration.Milliseconds
4747

4848
# Use FFmpeg to cut the video
4949
& ffmpeg -ss $StartCut -i $InputVideo -t $newDuration -c copy $OutputVideo

0 commit comments

Comments
 (0)