Skip to content

Instantly share code, notes, and snippets.

@1RedOne
Created October 29, 2018 17:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1RedOne/a486ac3e4ba5afa017eb190b5496b0d1 to your computer and use it in GitHub Desktop.
Save 1RedOne/a486ac3e4ba5afa017eb190b5496b0d1 to your computer and use it in GitHub Desktop.
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