Public/Start-Remux.ps1

function Start-Remux {
    <#
    .DESCRIPTION
    Remux files to mkv
 
    .NOTES
    Outpath folder must already be created prior to running the command
 
    .PARAMETER outpath
    Specify the save path for the remuxed files
 
    .Example
    Specify the output path for the remuxed files
 
    Start-Remux -outpath "c:\folder\folder new\"
    #>

    [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 = "*.avi"
    $array = @(Get-ChildItem -filter $ext)
    Foreach ($video in $array.Name) {
        $videoout = $video -split ".avi"
        ffmpeg.exe -i "$video" -c copy "$outpath$videoout.mkv"
    }

    $ext = "*.mp4"
    $array = @(Get-ChildItem -filter $ext)
    Foreach ($video in $array.Name) {
        $videoout = $video -split ".mp4"
        ffmpeg.exe -i "$video" -c copy "$outpath$videoout.mkv"
    }

    $ext = "*.mpg"
    $array = @(Get-ChildItem -filter $ext)
    Foreach ($video in $array.Name) {
        $videoout = $video -split ".mpg"
        ffmpeg.exe -i "$video" -c copy "$outpath$videoout.mkv"
    }
}