Functions/Functions.ps1
function Get-Tips { $tips } 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\" #> #> param ( [Parameter(Mandatory = $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" } } function Start-BurnSubtitles { <# .DESCRIPTION Burn subtitles from embeded subtitles or an srt file. Option exists to transcode or burn subtitles only. .NOTES Outpath folder must already be created prior to running the command .Example When using embeded subtitles specify the movie and the index for the embedded srt. Start-BurnSubtitles -Movie "Action Jackson.mkv" -outpath "c:\files\new files\" -subindex 0 -embed .Example When using embeded subtitles specify the movie and the index for the embedded srt. Start-BurnSubtitles -Movie "Action Jackson.mkv" -outpath "c:\files\new files\" -srtfile "Action Jackson.srt" -srt .Example If the transcode switch parameter is used then the file will be transcoded in addition to the subtitles being burned. Start-BurnSubtitles -Movie "Action Jackson.mkv" -outpath "c:\files\new files\" -srtfile "Action Jackson.srt" -srt -Transcode #> param ( [Parameter(Mandatory = $true, ParameterSetName = "embed")] [Parameter(Mandatory = $true, ParameterSetName = "srt")] $video, [Parameter(Mandatory = $true, ParameterSetName = "embed")] [Parameter(Mandatory = $true, ParameterSetName = "srt")] $outpath, [Parameter(Mandatory = $False, ParameterSetName = "embed")] [Parameter(Mandatory = $False, ParameterSetName = "srt")] [Switch] $transcode, [Parameter(Mandatory = $true, ParameterSetName = "embed")]$SubIndex, [Parameter(Mandatory = $true, ParameterSetName = "embed")][Switch]$Embed, [Parameter(Mandatory = $true, ParameterSetName = "srt")]$srtfile, [Parameter(Mandatory = $true, ParameterSetName = "srt")][Switch]$srt ) if ($transcode) { if ($Embed) { ffmpeg.exe -i "$video" -vf "subtitles=$video:si=$SubIndex" -c:v libx265 -crf 21 -ac 6 -c:a aac -preset veryfast "$outpath$video" } if ($srt) { ffmpeg.exe -i "$video" -vf "subtitles=$srtfile" -c:v libx265 -crf 21 -ac 6 -c:a aac -preset veryfast "$outpath$video" } } else { if ($Embed) { ffmpeg.exe -i "$video" -vf "subtitles=$video:si=$SubIndex" "$outpath$video" } if ($srt) { ffmpeg.exe -i "$video" -vf "subtitles=$srtfile" "$outpath$video" } } } function Start-Remux { <# .DESCRIPTION Remux files to mkv .NOTES Outpath folder must already be created prior to running the command .Example Specify the output path for the remuxed files Start-Remux -outpath "c:\folder\folder new\" #> param ( [Parameter(Mandatory = $true)]$outpath ) $ext = "*.avi" $array = @(Get-ChildItem -filter $ext) Foreach ($video in $array.Name) { $videoout = $video -split ".avi" ffmpeg -i "$video" -c copy "$outpath$videoout.mkv" } $ext = "*.mp4" $array = @(Get-ChildItem -filter $ext) Foreach ($video in $array.Name) { $videoout = $video -split ".mp4" ffmpeg -i "$video" -c copy "$outpath$videoout.mkv" } $ext = "*.mpg" $array = @(Get-ChildItem -filter $ext) Foreach ($video in $array.Name) { $videoout = $video -split ".mpg" ffmpeg -i "$video" -c copy "$outpath$videoout.mkv" } } |