Skip to content

Commit

Permalink
2023-11-13 16:39:19
Browse files Browse the repository at this point in the history
  • Loading branch information
uidHUB committed Nov 13, 2023
1 parent d3217f5 commit 97514c0
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions PkgStore.FFmpeg.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,27 @@ function Compress-Video() {
[Alias('EXT')][string]$P_Extension = 'mp4'
)

Test-App
# Checking FFmpeg location.
Test-FFmpeg

(Get-ChildItem $P_In -File) | ForEach-Object {
# Composing a app command.
$Param = @('-hide_banner')
$Param += @('-i', "${_}")
$Param += @('-c:v', "${P_vCodec}")
if ($P_CRF) { $Param += @('-crf', "${P_CRF}") }
if ($P_Preset) { $Param += @('-preset', "${P_Preset}") }
if ($P_Framerate) { $Param += @('-r', "${P_Framerate}") }
$Param += @('-c:a', "${P_aCodec}")
$Param += @("$($(Join-Path $_.DirectoryName $_.BaseName)).$P_Extension")
(Get-Item $P_In) | ForEach-Object {
$I = "$($_.FullName)" # Input data.
$O = "$($_.FullName.TrimEnd($_.Extension)).${P_Extension}" # Output data.

$Param = @('-hide_banner') # Hide FFmpeg banner.
$Param += @('-i', "${I}") # Input data.
$Param += @('-c:v', "${P_vCodec}") # Video codec.
if ($P_CRF) { $Param += @('-crf', "${P_CRF}") } # Constant Rate Factor.
if ($P_Preset) { $Param += @('-preset', "${P_Preset}") } # Video preset.
if ($P_Framerate) { $Param += @('-r', "${P_Framerate}") } # Video frame rate.
$Param += @('-c:a', "${P_aCodec}") # Audio codec.
$Param += @("${O}") # Output data.

# Running a app.
& "${AppExe}" $Param
}
}

function Test-App {
function Test-FFmpeg {
<#
.SYNOPSIS
Expand Down

0 comments on commit 97514c0

Please sign in to comment.