Created
August 10, 2021 14:45
-
-
Save JamesDBartlett3/ecac4616fae42178f187fa7ef10e722d to your computer and use it in GitHub Desktop.
Compress-WebinarVideo: A PowerShell function that leverages ffmpeg to reduce the size of a webinar video file for more efficient storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------------------------------------------------ | |
# Author: James Bartlett @jamesdbartlett3 | |
# Synopsis: Uses ffmpeg to compress a webinar video to a much more manageable size | |
# Requires: ffmpeg CLI application, accessible in path | |
# Assumes: | |
#------------------------------------------------------------------------------------------------------------------ | |
function Compress-WebinarVideo { | |
Param( | |
[Parameter(Mandatory=$True, Position=0, ValueFromPipeline=$True)] | |
[string]$inputVid, | |
[Parameter(Mandatory=$False, Position=1, ValueFromPipeline=$False)] | |
[int]$frameRate=12 | |
) | |
[string]$targetDir = Get-ItemPropertyValue -Path $inputVid -Name FullName | Split-Path -Path {$_} | |
[string]$inputFileBase = Get-ItemPropertyValue -Path $inputVid -Name BaseName | |
[string]$inputFileExtension = Get-ItemPropertyValue -Path $inputVid -Name Extension | |
[string]$outputFile = "$targetDir\$inputFileBase" + "_[" + $frameRate + "fps]" + $inputFileExtension | |
ffmpeg -i $inputVid -c:v libx265 -filter:v fps=fps=$frameRate -ac 1 -ar 22050 $outputFile | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment