How to Concatenate TS Files on macOS with FFmpeg

This guide explains how to quickly merge and concatenate multiple TS (MPEG Transport Stream) video files on macOS using FFmpeg. By utilizing the stream copy feature (-c copy), you can join your video clips instantly without re-encoding, which preserves the original video and audio quality and saves significant processing time.

Prerequisite: Install FFmpeg on macOS

Before starting, ensure you have FFmpeg installed. The easiest way to install it on macOS is via Homebrew. Open your Terminal application and run:

brew install ffmpeg

Method 1: Using the FFmpeg Concat Protocol (Best for a Few Files)

Because TS is a container format designed for streaming, you can easily feed multiple files directly into FFmpeg using the concat protocol. This is the fastest method if you only have a few files to merge.

  1. Open Terminal and navigate to the folder containing your TS files using the cd command:

    cd /path/to/your/folder
  2. Run the following command, separating each file name with a pipe symbol (|):

    ffmpeg -i "concat:file1.ts|file2.ts|file3.ts" -c copy output.ts

Method 2: Using the FFmpeg Concat Demuxer (Best for Many Files)

If you have a large number of TS files, typing them out manually becomes impractical. The concat demuxer reads a text list of your files and merges them in order.

  1. Open Terminal and navigate to your TS files’ directory:

    cd /path/to/your/folder
  2. Generate a text file containing the paths of all .ts files in alphabetical order by running this command:

    printf "file '%s'\n" *.ts > filelist.txt

    This creates a file named filelist.txt formatted like this:

    file 'file1.ts'
    file 'file2.ts'
    file 'file3.ts'
  3. Run the FFmpeg command to concatenate the files listed in the text file:

    ffmpeg -f concat -safe 0 -i filelist.txt -c copy output.ts

Once the process finishes, you will find your merged output.ts file in the same directory.