2023-11-12 05:48:40
This commit is contained in:
parent
ab188b381f
commit
135ef3cc68
5 changed files with 104 additions and 1 deletions
0
CHANGELOG.md
Normal file
0
CHANGELOG.md
Normal file
14
CONTRIBUTING.md
Normal file
14
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Contributing
|
||||
|
||||
- Feedback, wishes and suggestions can be sent by email.
|
||||
- Constructive criticism, bug descriptions and other reports are welcome.
|
||||
- Email: [mail@ihub.to](mailto:mail@ihub.to).
|
||||
|
||||
## Sources
|
||||
|
||||
- [**GitHub**](https://github.com/pkgstore)
|
||||
- [GitLab](https://gitlab.com/pkgstore) (MIRROR)
|
||||
- [Codeberg](https://codeberg.org/pkgstore) (MIRROR)
|
||||
- [Disroot](https://git.disroot.org/pkgstore) (MIRROR)
|
||||
- [MosHub](https://hub.mos.ru/pkgstore) (MIRROR)
|
||||
- [Git.Org.Ru](https://git.org.ru/pkgstore) (MIRROR)
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Package Store
|
||||
Copyright (c) 2023 iHub.TO <https://ihub.to>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
19
PkgStore.FFmpeg.psd1
Normal file
19
PkgStore.FFmpeg.psd1
Normal file
|
@ -0,0 +1,19 @@
|
|||
@{
|
||||
RootModule = 'PkgStore.FFmpeg.psm1'
|
||||
ModuleVersion = '0.1.0'
|
||||
GUID = '82549e1a-69f4-407b-baff-4f97d75b9852'
|
||||
Author = 'Kitsune Solar'
|
||||
CompanyName = 'iHub.TO'
|
||||
Copyright = '(c) 2023 Kitsune Solar. All rights reserved.'
|
||||
Description = ''
|
||||
PowerShellVersion = '7.1'
|
||||
RequiredModules = @('PkgStore.Kernel')
|
||||
FunctionsToExport = @('Compress-Video')
|
||||
PrivateData = @{
|
||||
PSData = @{
|
||||
Tags = @('pwsh', 'ffmpeg')
|
||||
LicenseUri = 'https://github.com/pkgstore/pwsh-ffmpeg/blob/main/LICENSE'
|
||||
ProjectUri = 'https://github.com/pkgstore/pwsh-ffmpeg'
|
||||
}
|
||||
}
|
||||
}
|
70
PkgStore.FFmpeg.psm1
Normal file
70
PkgStore.FFmpeg.psm1
Normal file
|
@ -0,0 +1,70 @@
|
|||
<#PSScriptInfo
|
||||
.VERSION 0.1.0
|
||||
.GUID 82549e1a-69f4-407b-baff-4f97d75b9852
|
||||
.AUTHOR Kitsune Solar
|
||||
.AUTHOREMAIL mail@kitsune.solar
|
||||
.COMPANYNAME iHub.TO
|
||||
.COPYRIGHT 2023 Kitsune Solar. All rights reserved.
|
||||
.LICENSEURI https://github.com/pkgstore/pwsh-curl/blob/main/LICENSE
|
||||
.PROJECTURI
|
||||
#>
|
||||
|
||||
$App = @('ffmpeg.exe')
|
||||
$AppExe = @{LiteralPath = "${PSScriptRoot}"; Filter = "$($App[0])"; Recurse = $true; File = $true}
|
||||
$AppExe = ((Get-ChildItem @AppExe) | Select-Object -First 1)
|
||||
$NL = "$([Environment]::NewLine)"
|
||||
|
||||
function Compress-Video() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
.DESCRIPTION
|
||||
#>
|
||||
|
||||
Param(
|
||||
[Parameter(Mandatory)][Alias('F')][string[]]$P_Files,
|
||||
[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'
|
||||
)
|
||||
|
||||
Test-App
|
||||
|
||||
(Get-ChildItem $P_Files -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)")
|
||||
|
||||
# Running a app.
|
||||
& "${AppExe}" $Param
|
||||
}
|
||||
}
|
||||
|
||||
function Test-App {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
|
||||
.DESCRIPTION
|
||||
#>
|
||||
|
||||
# Getting 'curl.exe' directory.
|
||||
$Dir = "$($AppExe.DirectoryName)"
|
||||
|
||||
# Checking the location of files.
|
||||
$App | ForEach-Object {
|
||||
if (-not (Test-Data -T 'F' -P "${Dir}\${_}")) {
|
||||
Write-Msg -T 'W' -A 'Stop' -M ("'${_}' not found!${NL}${NL}" +
|
||||
"1. Download '${_}' from 'https://www.gyan.dev/ffmpeg/builds/'.${NL}" +
|
||||
"2. Extract all the contents of the archive into a directory '${PSScriptRoot}'.")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue