Created
October 29, 2018 17:41
-
-
Save 1RedOne/a486ac3e4ba5afa017eb190b5496b0d1 to your computer and use it in GitHub Desktop.
Join Video Files with FFMPEG and PowerShell
This file contains hidden or 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
Function Join-VideoDirectory { | |
$fileArray = New-Object System.Collections.ArrayList | |
$items = Get-childitem *.mkv,*.vob,*.mp4,*.ts | |
$itemCount = $items.Count | |
$i = 0 | |
$cmdScript = "" | |
ForEach ($item in $items){ | |
$i++ | |
$cmdScript += "ffmpeg -i `"$($item.Name)`" -f mpegts -c copy file-0$i.mpeg.ts`n" | |
$fileArray.Add("file-0$i.mpeg.ts") | |
} | |
$cmdScript+="ffmpeg -isync -i `"concat:$($fileArray -join '|')`" -f matroska -c copy output.mkv" | |
Invoke-Expression $cmdScript | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment