Public/Start-Transcode.ps1
function Start-Transcode { <# .DESCRIPTION Transcodes video files containing extenstions *.mp4, *.mkv, *.avi, and *.mpg Inputed Parameters are -c:v libx265 -crf 21 -ac 6 -c:a aac -preset veryfast .NOTES Outpath folder must already be created prior to running the command .Example Specify the output path for the remuxed files Start-Transcode -outpath "c:\files\new files\" #> [cmdletbinding()] param ( [Parameter(Mandatory = $true)] [ValidateScript( { if ( -not (Test-Path $_)) { throw "Path '$_' doesn't exist. Create the Directory First" } else { $true } })] [ValidateScript( { if ($_ -notmatch '.+?\\$') { throw "Path '$_' must end with a backslash" } else { $true } })] $outpath ) $ext = "*.mkv" $array = @(Get-ChildItem -filter $ext) Foreach ($video in $array.Name) { ffmpeg.exe -i $video -c:v libx265 -crf 21 -ac 6 -c:a aac -preset veryfast "$outpath$video" } $ext = "*.avi" $array = @(Get-ChildItem -filter $ext) Foreach ($video in $array.Name) { ffmpeg.exe -i $video -c:v libx265 -crf 21 -ac 6 -c:a aac -preset veryfast "$outpath$video" } $ext = "*.mp4" $array = @(Get-ChildItem -filter $ext) Foreach ($video in $array.Name) { ffmpeg.exe -i $video -c:v libx265 -crf 21 -ac 6 -c:a aac -preset veryfast "$outpath$video" } $ext = "*.mpg" $array = @(Get-ChildItem -filter $ext) Foreach ($video in $array.Name) { ffmpeg.exe -i $video -c:v libx265 -crf 21 -ac 6 -c:a aac -preset veryfast "$outpath$video" } } |