How to Combine .ts Video Segments Into One MP4 on Mac
Four ways to join .ts segments into one MP4, measured on the same files: three keep exact timing, one adds a gap at every join. Plus two traps.
On this page
The most reliable way to combine .ts segments into an MP4 is to join them in the right order and remux once. Either use cat on the files and then ffmpeg -i joined.ts -c copy out.mp4, or give FFmpeg the concat protocol (-i "concat:a.ts|b.ts|…"). If you still have the .m3u8 playlist, pointing FFmpeg at it is simpler still. In my tests, all three produced a file exactly as long as the original. FFmpeg’s concat demuxer, the method most often recommended, didn’t: it left a small gap at every join.
Everything below was measured on the same ten segments: a 60-second 1080p H.264 + AAC stream cut into 6-second MPEG-TS files, about 39.7 MB in total. I used FFmpeg 8.1.2 on an Apple M4 Mac with macOS 26.6.2, on 21 October 2026.
Rights first: join only segments from streams you’re entitled to keep.
Key takeaways:
- 3 of 4 methods kept exact timing: byte join plus remux, the concat protocol, and the original
.m3u8, all 60.032 s. - The concat demuxer added 9 gaps of 50 to 100 ms at the joins, about half a second in all.
- Sort with
sort -V. Plainlsand shell globs putseg10.tsbeforeseg2.ts, evenls -von macOS. - A missing segment fails quietly: “Packet corrupt” warnings and a 24-second file from 18 seconds of video.
- The remux is lossless and slightly smaller: 39.7 MB of TS became a 38.6 MB MP4.
What a .ts segment is, and why it joins well
A .ts file is an MPEG-2 transport stream, defined in ITU-T H.222.0 (also published as ISO/IEC 13818-1), and registered with IANA as video/MP2T. A transport stream is a sequence of fixed-size 188-byte packets, each starting with the sync byte 0x47. My test segments matched: each started with 47 40 11 10 and was an exact multiple of 188 bytes.
Transport streams were designed for broadcast, where a receiver can tune in partway through, so there’s no file-wide header or index to rebuild. That’s why HLS uses them as segments (RFC 8216 lists MPEG-2 TS as a segment format). It’s also why the segments of one stream can be appended byte for byte and still play.
MP4 is the opposite. It keeps an index of every sample, so it can’t simply be appended to. The usual workflow is therefore: join the TS data, then remux once into MP4. Remuxing copies the existing H.264 and AAC into the new container without decoding or re-encoding. It also dropped the transport stream overhead: my 39.7 MB of .ts became a 38.6 MB MP4, 2.7% smaller, with the same video.
- Order the segments
sort -VNumeric order, not alphabetical - Join the TS data
cat … > joined.tsor the concat protocol - Remux once
ffmpeg -i joined.ts -c copy out.mp4Streams copied, container changed - Check the length
ffprobe … durationShould equal the sum of the segments
How to merge TS files to MP4: four methods, measured
| Method | Command (abbreviated) | Output duration | Gaps at joins |
|---|---|---|---|
| 1. Byte join, then remux | cat part*.ts > joined.ts then ffmpeg -i joined.ts -c copy out.mp4 |
60.032 s | None |
| 2. Concat protocol | ffmpeg -i "concat:part0.ts|part1.ts|…" -c copy out.mp4 |
60.032 s | None |
| 3. The original playlist | ffmpeg -i index.m3u8 -c copy out.mp4 |
60.032 s | None |
| 4. Concat demuxer | ffmpeg -f concat -safe 0 -i list.txt -c copy out.mp4 |
60.528 s | 9 gaps, 50–100 ms each |
The first three matched the original stream to the millisecond. To count gaps, I listed every audio packet’s timestamp with ffprobe and looked for jumps longer than 50 ms. Methods 1 to 3 had none. Method 4 had one at every join: for example, audio jumped from 5.952 s to 6.021 s, and from 11.995 s to 12.069 s. That adds up to the extra half second: a short hole in the audio and video timeline at every segment boundary.
FFmpeg’s formats documentation explains the difference. The concat demuxer “demuxes” each listed file “one after the other”, and requires all files to “have the same streams (same codecs, same time base, etc.)”. It shifts timestamps so that “each next file starts where the previous one finishes”, and the docs warn this “may cause gaps if all streams do not have exactly the same length”. Within one segment, audio and video rarely end at exactly the same moment. In my files, the audio and video inside each segment started and ended slightly apart: the first segment held 6.000 s of video but 5.867 s of audio. The concat protocol, by contrast, reads the files “in sequence as if they were a unique resource”. For segments cut from one continuous transport stream, the protocol and cat keep the stream’s own continuous timestamps, which is what you want.
Method 1 in full
cd ~/Downloads/segments
ls *.ts | sort -V | xargs cat > joined.ts
ffmpeg -i joined.ts -c copy video.mp4
Method 2 in full
ffmpeg -i "concat:$(ls *.ts | sort -V | paste -sd'|' -)" -c copy video.mp4
Method 3, if you have the playlist
If the folder still contains the .m3u8 with the segments it names, FFmpeg’s HLS demuxer reads the order from it:
ffmpeg -i index.m3u8 -c copy video.mp4
If the playlist still works online, you don’t need the local files at all. See downloading an M3U8 to MP4.
Mistake 1: the wrong order
Shells and ls sort names alphabetically, so seg10.ts comes before seg2.ts. With twelve files named seg0.ts to seg11.ts, I got these orders on macOS 26.6.2:
| Command | Order |
|---|---|
echo seg*.ts (zsh or bash) |
seg0, seg1, seg10, seg11, seg2 … seg9 |
ls |
the same |
ls -v |
the same; on macOS, -v doesn’t sort numerically |
ls | sort -V |
seg0, seg1, seg2 … seg9, seg10, seg11 |
Use sort -V (version sort), or zero-padded names like seg_000.ts, which sort correctly anyway. A file joined in the wrong order still plays, but with scenes in the wrong place, and the timestamps jump.
Mistake 2: a missing segment
If one segment didn’t download, nothing fails loudly. I joined part0, part1 and part3, skipping part2, and remuxed. FFmpeg printed “Packet corrupt” warnings and produced a 24-second file from 18 seconds of video, because the timestamps jumped from 11.99 s to 18.02 s. Players show that as a frozen frame or a skip.
So count your segments against the playlist’s #EXTINF entries before joining, and check that the output duration matches:
ffprobe -v error -show_entries format=duration -of csv=p=0 video.mp4
Where VidNeat fits
VidNeat is our app, and it works from links, not files on disk. Dropping a local .ts (or .mp4) onto it does nothing, so it isn’t a tool for joining segments you already have. Use the FFmpeg commands above for that.
Limits, plainly: it can’t join files already on your Mac, only download a stream from a link that still works.
It’s useful one step earlier. If the stream’s playlist is still online, paste the .m3u8 address and VidNeat fetches the segments, five at a time with retries, keeps them in order, and writes one MP4. On my test playlist, that gave a 60.03-second MP4 with the same codecs as the source, and none of the joins described above were left to me. How HLS downloaders assemble segments covers that process in detail, and stream-copy trimming covers cutting the result without re-encoding.
Common questions
Do I need to convert the TS to MP4 at all?
A joined .ts plays in VLC and many editors. MP4 is better supported by QuickTime and Apple’s apps, and the remux takes seconds because nothing is re-encoded.
What if the segments are .m4s, not .ts?
Those are fragmented MP4 segments. They need their initialization segment (init.mp4) first, and they can be joined with cat in that order. The DASH page shows the exact commands I tested.
What is the best TS joiner on a Mac?
FFmpeg, which is free. ls *.ts | sort -V | xargs cat > joined.ts then ffmpeg -i joined.ts -c copy video.mp4 joins and remuxes in seconds with no loss.
Can I merge TS files without FFmpeg?
You can join them with cat alone, and the resulting .ts plays in VLC. Converting it to MP4 still needs a remuxing tool such as FFmpeg.
Does joining reduce quality?
No. Every method here copies the streams. Only re-encoding, for example by leaving out -c copy, changes the picture.
What does “Packet corrupt” mean when I join?
In my test it meant a segment was missing, so the timestamps jumped. Check the count and order first.
Summary
- TS is made of 188-byte packets with no file-wide index, so segments from one stream can be appended.
- Byte join or the concat protocol, then one remux, gave a file exactly the original length. So did reading the original
.m3u8. - The concat demuxer added 9 small gaps (about 0.5 s in total) on the same files.
- Sort with
sort -V, and check the segment count and the output duration. - If the playlist is still online, download from it instead, with FFmpeg or VidNeat.
Related reading
HLS Stream Recorder: How to Save an HLS Stream as MP4
How HLS is built (playlist types, variants, TS and fMP4 segments), what a downloader does to make one MP4, and how live streams differ. Measured.
How to Download an M3U8 Video to MP4 on Mac (and From Chrome)
An .m3u8 is a text playlist, not a video. What's inside one, why a browser save fails, and three tested ways to turn it into one MP4 on a Mac.
MPEG-DASH MPD to MP4: How DASH Works and How to Convert It on Mac
An .mpd is an XML manifest for separate audio and video tracks. How to read one, why Homebrew's FFmpeg can't, and three tested ways to make an MP4.
Trim with FFmpeg without re-encoding
Installing FFmpeg on a Mac, and cutting the merged file losslessly.
Get the clip you need. Not the entire video.
A native Mac downloader that fetches the range you mark and cuts by copying streams. Requires macOS 14.0 Sonoma or later.
VidNeat is a software tool. You are responsible for having the rights or permission to access, use, edit and export the media you work with.