Concatenate TS Files on Windows Using FFmpeg Copy
This article provides a straightforward, step-by-step guide on how to concatenate multiple TS (Transport Stream) video files on Windows using FFmpeg’s stream copy feature. You will learn how to quickly merge your video segments using the command line without re-encoding, which preserves the original video quality and completes the process almost instantly.
Method 1: Using the FFmpeg Concat Protocol
Because TS files are designed for streaming, they can be easily
joined together using FFmpeg’s built-in concat protocol.
This method is ideal if you have a small number of files and do to want
to create an external text list.
- Open the Command Prompt (cmd) and navigate to the folder containing your TS files.
- Run the following command, replacing the input names with your actual file names:
ffmpeg -i "concat:input1.ts|input2.ts|input3.ts" -c copy output.tsconcat:input1.ts|input2.ts|input3.tstells FFmpeg to read the files sequentially.-c copyinstructs FFmpeg to copy the video and audio streams directly without re-encoding them.
Method 2: Using the FFmpeg Concat Demuxer (Recommended for many files)
If you have a large number of TS files, listing them individually in the command line can be tedious. The Concat Demuxer reads file names from a text document.
- Create a text file named
inputs.txtin the same directory as your TS files. - Open the text file and list your TS files in chronological order using the format below:
file 'part1.ts'
file 'part2.ts'
file 'part3.ts'
- Save and close the text file.
- Open Command Prompt in that directory and run the following command:
ffmpeg -f concat -safe 0 -i inputs.txt -c copy output.ts-f concatspecifies the concat demuxer format.-safe 0allows the use of relative or absolute file paths.-c copyperforms the stream copy, merging the files in seconds.
Method 3: Using the Windows Command Line (Alternative)
Because of the unique structure of TS files, you can also concatenate them directly using the native Windows command prompt without launching FFmpeg, using a binary copy command.
- Open Command Prompt in your working folder.
- Run the following command:
copy /b input1.ts+input2.ts+input3.ts output.tsAlternatively, to merge all TS files in a folder alphabetically using Windows CMD:
copy /b *.ts output.tsNote: While the Windows copy /b command works well
for TS files, using FFmpeg (Methods 1 and 2) is recommended as it cleans
up any potential container errors or timestamp issues during the merging
process.