Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Join Video Files with FFMPEG and PowerShell
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
You can’t perform that action at this time.