Program to join TS videos using command line

I have a need to join .ts video files. I know of which works very well, but as far as I can tell it is GUI only.

I need to be able to do this from the command line in Windows. Are there any solutions out there that can handle this?

3 Answers

ffmpeg for windows

ffmpeg.exe -i concat:file1.ts^|file2.ts^|file3.ts -vcodec copy -acodec copy -f vob combined.mpg
1

I would simply use the command line. Navigate to the folder with all *.ts-files to be concatenated and then run the...

copy /b *.ts output-file.ts

...command, which takes all *.ts-files in the current directory and concatenates them to a resulting file called output-file.ts. The command might run for several minutes, so don't worry, you can grab a cup of coffee now ;)

(as the *.ts-format - "Transport Stream" - is a streaming format, it is possible to easily just "add one file after another" without damaging the data inside)


source:

You can merge the files with copy /b *.ts output-file.ts as mozzbozz suggest.

However, keep in mind if the filenames are not using leading zeros (1.ts, 2.ts ... 9.ts, 10.ts ... 99.ts, 100.ts ...), the copy command will use alphabetic lexical order to concatenate the files resulting in wrong order and output-file.ts will be glitching back and forth (1.ts, 10.ts, 100.ts, 2.ts, 20.ts, ... 9.ts ... 99.ts, 999.ts).

Filename alphabetical lexical order must match the natural order of video clips. This is fixed by using leading zeros:

for %i in (?.ts) do ren %i 000%i
for %i in (??.ts) do ren %i 00%i
for %i in (???.ts) do ren %i 0%i
copy /b ????.ts output-file.ts

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like