MPEG TS: The MPEG Transport Stream Format Explained
In this article
MPEG transport stream (MPEG-TS) is a digital container format standardized by the Moving Picture Experts Group (MPEG) and defined in ISO/IEC 13818-1. It is designed to carry video, audio, and metadata over unreliable or error-prone channels, such as broadcast television, satellite links, and IP networks. Unlike simpler file formats like MP4, MPEG-TS is built for streaming: it splits data into small, fixed-size packets that can be reassembled even if some are lost or corrupted. This article explains how MPEG-TS works, where it is used, its strengths and weaknesses, and how it compares to other formats.
Background: Why MPEG-TS Was Created
In the early 1990s, digital television was emerging, but broadcasters faced a problem: analog signals degrade gracefully, while digital data is all-or-nothing. A single corrupted bit could ruin an entire frame. The MPEG committee designed the transport stream to solve this by breaking audio and video into tiny packets, each with its own error-correction and timing information. This way, a receiver can drop bad packets and still reconstruct a usable signal.
MPEG-TS was also designed for multiplexing—carrying multiple programs (TV channels) in one stream. A single satellite transponder can transmit several channels simultaneously, each with its own video, audio, and subtitles, all interleaved into one TS. This is why MPEG-TS is the backbone of DVB (Digital Video Broadcasting), ATSC (Advanced Television Systems Committee), and ISDB (Integrated Services Digital Broadcasting) standards.
How MPEG-TS Works: Packets and PES
MPEG-TS wraps compressed elementary streams (video, audio, data) into Packetized Elementary Stream (PES) packets, which are then split into 188-byte transport packets. Each TS packet has a 4-byte header and up to 184 bytes of payload. The header includes:
- Sync byte (0x47) – marks the start of each packet.
- Packet Identifier (PID) – a 13-bit field that identifies the stream (e.g., PID 0x100 for video, 0x101 for audio).
- Continuity counter – a 4-bit sequence number that helps detect lost packets.
- Adaptation field control – indicates whether the packet carries payload, adaptation field, or both.
The adaptation field can contain program clock reference (PCR), which lets the receiver synchronize its clock to the encoder. This timing is crucial for keeping audio and video in sync.
Because each packet is independent, a receiver can start decoding mid-stream—it just waits for a keyframe (I-frame) and begins. This is why MPEG-TS is ideal for live broadcasts: you can tune in at any moment without downloading the whole file.
Key Features: Error Resilience and Multiplexing
Two features make MPEG-TS unique:
- Error resilience – Each packet is small enough that a burst of noise only corrupts a few packets, not a whole frame. Forward error correction (FEC) is often added at the link layer (e.g., in DVB) to recover lost packets.
- Multi-program support – A single TS can carry multiple programs, each with its own program map table (PMT) that lists the PIDs for its components. The program association table (PAT) lists all PMTs. This allows a set-top box to select one channel from many.
MPEG-TS also supports conditional access (scrambling) for pay-TV, though that is a separate layer.
Common Uses: Where You'll Encounter MPEG-TS
You'll find MPEG-TS in:
- Digital TV broadcasting – DVB-T, DVB-S, ATSC, ISDB all use MPEG-TS over the air.
- Live streaming – HTTP Live Streaming (HLS) uses MPEG-TS segments (though newer versions support fMP4).
- DVR and PVR recordings – Many set-top boxes record raw TS files (.ts) directly from the tuner.
- Professional video transport – Contribution links between studios often use MPEG-TS over IP (e.g., in ST 2110, though that's a different format).
- DVD/Blu-ray? No – Those use MPEG program stream (PS), which is a sibling format for reliable storage.
If you've ever downloaded a .ts file from a TV recording, you've seen MPEG-TS in action.
MPEG-TS vs. MP4: Which to Choose?
The main difference is resilience vs. efficiency:
- MP4 is a file format optimized for local playback and editing. It has a moov atom at the beginning (or end) that contains metadata, so the player must read the whole file before playing. MP4 is not designed for packet loss.
- MPEG-TS is a streaming format. It can be played while downloading, tolerates packet loss, and supports live multiplexing. However, it has more overhead (about 4% for headers) and is less efficient for storage.
For file distribution, MP4 is usually better. For live streaming or broadcast, MPEG-TS is the standard. Some systems convert TS to MP4 after recording to save space.
Common Problems and Misconceptions
“TS files are corrupted” – Often they're not; they're just incomplete recordings. Because TS is a stream, a player may not know where the video ends. Tools like ffmpeg can repair or convert them.
“MPEG-TS is low quality” – The container doesn't determine quality; the codec and bitrate do. A TS can carry high-bitrate H.264 or HEVC just as well as MP4.
“TS is only for TV” – While true historically, TS is also used in web streaming (HLS) and even some security camera systems.
Packet loss handling – If a TS packet is lost, the receiver drops it. If it's a keyframe, the video freezes until the next I-frame. This is why broadcasters insert I-frames frequently (e.g., every 2 seconds).
How to Work with MPEG-TS Files
If you have a .ts file, you can:
- Play it – VLC, ffplay, and most media players support TS.
- Convert to MP4 – Use ffmpeg:
ffmpeg -i input.ts -c copy output.mp4(fast, no re-encode). - Extract a stream –
ffmpeg -i input.ts -map 0:v -c copy video.h264 - Inspect PIDs – Use
ffprobeor a tool like DVB Inspector.
For live streaming, you might use a muxer like ffmpeg to generate TS segments for HLS.
Frequently Asked Questions
Is MPEG-TS the same as MPEG-2?
No. MPEG-2 is a video codec (though it also includes audio and system specs). MPEG-TS is a container that can carry MPEG-2 video, but also H.264, HEVC, and others. The confusion arises because early digital TV used both together.
Why do TS files have a .ts extension?
The extension comes from the format name “transport stream.” It's not an official standard, but it's widely used for recorded broadcasts. Some systems use .m2ts for Blu-ray, which is a variant with different packet sizes.
Can I edit a TS file without losing quality?
Yes, if you cut on keyframes and use a tool like ffmpeg with -c copy, you can trim without re-encoding. But because TS is a stream, you must ensure the cut points are on I-frames to avoid playback issues.
What's the difference between TS and M2TS?
M2TS is a variant used on Blu-ray discs, with 192-byte packets (188 bytes + 4 bytes of timestamp). It's essentially MPEG-TS with extra timing info for AVCHD. Most players handle both.
Does MPEG-TS support subtitles?
Yes, subtitles can be carried as separate PES streams (e.g., DVB subtitles) or in the adaptation field (e.g., teletext). They are identified by PID and can be selected by the player.
Is MPEG-TS still relevant with modern streaming?
Yes. HLS and DASH often use fragmented MP4 now, but MPEG-TS remains in broadcast, and many legacy systems still use it. It's also used in some low-latency streaming protocols because of its packet structure.