Skip to content

Commit

Permalink
2023-11-18 22:54:13
Browse files Browse the repository at this point in the history
  • Loading branch information
uidHUB committed Nov 18, 2023
1 parent 82258dd commit 1e7f473
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion PkgStore.FFmpeg.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ PrivateData = @{
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'pwsh','ffmpeg'
Tags = 'pwsh', 'ffmpeg'

# A URL to the license for this module.
LicenseUri = 'https://github.com/pkgstore/pwsh-ffmpeg/blob/main/LICENSE'
Expand Down
2 changes: 1 addition & 1 deletion Private/Start-FFmpeg.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Start-FFmpeg {
[Alias('AD')][string[]]$AppData = @('ffmpeg.exe')
)

$AppPath = (Split-Path -Path "${PSScriptRoot}" -Parent)
$AppPath = (Split-Path "${PSScriptRoot}" -Parent)
$App = @{LiteralPath = "${AppPath}"; Filter = "$($AppData[0])"; Recurse = $true; File = $true}
$App = ((Get-ChildItem @App) | Select-Object -First 1)
$NL = [Environment]::NewLine
Expand Down
28 changes: 14 additions & 14 deletions Public/Compress-Video.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ function Compress-Video() {
#>

Param(
[Parameter(Mandatory)][Alias('I')][string[]]$P_In,
[Alias('CV')][string]$P_vCodec = 'libx265',
[Alias('CA')][string]$P_aCodec = 'copy',
[Alias('R')][int]$P_Framerate,
[Alias('C')][int]$P_CRF,
[Alias('PS')][string]$P_Preset,
[Alias('EXT')][string]$P_Extension = 'mp4'
[Parameter(Mandatory)][Alias('I')][string[]]$In,
[Alias('CV')][string]$vCodec = 'libx265',
[Alias('CA')][string]$aCodec = 'copy',
[Alias('R')][int]$Framerate,
[Alias('C')][int]$CRF,
[Alias('PS')][string]$Preset,
[Alias('EXT')][string]$Extension = 'mp4'
)

(Get-Item $P_In) | ForEach-Object {
(Get-Item $In) | ForEach-Object {
$I = "$($_.FullName)" # Input data.
$O = "$($_.FullName.TrimEnd($_.Extension)).${P_Extension}" # Output data.
$O = "$($_.FullName.TrimEnd($_.Extension)).${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 += @('-c:v', "${vCodec}") # Video codec.
if ($CRF) { $Param += @('-crf', "${CRF}") } # Constant Rate Factor.
if ($Preset) { $Param += @('-preset', "${Preset}") } # Video preset.
if ($Framerate) { $Param += @('-r', "${Framerate}") } # Video frame rate.
$Param += @('-c:a', "${aCodec}") # Audio codec.
$Param += @("${O}") # Output data.

& $(Start-FFmpeg) $Param
Expand Down

0 comments on commit 1e7f473

Please sign in to comment.