.TS MPEG Transport Stream
.ts

MPEG Transport Stream

Convert MPEG Transport Stream (.ts) files to MP4, WebM, or GIF directly in your browser — no upload, no server, no quality loss. FileDex uses FFmpeg WASM to remux or transcode locally, keeping your video files private.

Learn more ↓
Container structure
PAT program table
PMT stream map
PES 188B packets
ContainerMPEG-2 TS188-byte packetsBroadcasting1995
By FileDex

Your files never leave your device

Common questions

How do I convert a .ts file to MP4 without losing quality?

Use stream copy (remux) instead of re-encoding. In FileDex, drop your .ts file and select MP4 as the output — the conversion remuxes the container without touching the video or audio data. From the command line: `ffmpeg -i input.ts -c copy output.mp4`. The result is byte-identical in quality.

Why is my .ts file from a TV recording so large?

Broadcast TS files often contain multiple audio tracks (different languages), teletext data, EPG metadata, and unused PIDs that inflate file size. Remuxing to MP4 with a single audio track strips the excess data. MPEG-2 video codec used in older broadcasts also produces larger files than H.264.

Can I play .ts files in a web browser?

Browsers do not play .ts files natively via the HTML5 video element. Use hls.js or Video.js to demux TS segments client-side and feed them to Media Source Extensions (MSE). Alternatively, remux to MP4 for direct browser playback.

What is the difference between .ts and .m2ts files?

.ts uses standard 188-byte packets defined by MPEG-2 Systems. .m2ts (Blu-ray BDAV) uses 192-byte packets — the extra 4 bytes contain a timestamp for Blu-ray disc seeking. Both carry the same elementary streams, but .m2ts is specific to Blu-ray disc structure.

What makes .TS special

Transport Stream is the armored truck of video containers — built from the ground up to survive hostile transmission environments where data loss is inevitable, not exceptional. Defined in the MPEG-2 Part 1 specification (ISO/IEC 13818-1), TS was engineered for broadcast television, satellite links, and live streaming, where a single corrupted byte cannot halt playback. Every 188-byte packet begins with a sync byte (0x47), and each stream carries a continuity counter per PID — if a receiver detects a gap in the counter sequence, it knows exactly which packets were lost, enabling error recovery impossible in Program Stream or MP4.

Continue reading — full technical deep dive

Packet architecture

A TS file is a flat sequence of fixed-size packets. Each 188-byte packet contains a 4-byte header and 184 bytes of payload. The header carries:

Field Bits Purpose
Sync byte 8 Always 0x47, marks packet start
TEI 1 Transport Error Indicator
PUSI 1 Payload Unit Start Indicator
Priority 1 Transport priority flag
PID 13 Identifies the elementary stream
Scrambling 2 Encryption control bits
Adaptation 2 Signals adaptation field presence
Continuity 4 0-15 rolling counter per PID

The fixed packet size is deliberate. Hardware demultiplexers in set-top boxes and TV tuners can lock onto the 0x47 pattern without buffering the entire file. If corruption destroys one packet, the decoder skips forward 188 bytes and resynchronizes. MP4, by contrast, relies on its moov atom for stream indexing — if that atom is damaged, the entire file becomes unreadable.

Multiplexing and program tables

TS multiplexes multiple programs into a single bitstream using Program Specific Information (PSI) tables. The Program Association Table (PAT, PID 0x0000) maps program numbers to their Program Map Table (PMT) PIDs. Each PMT then lists the elementary stream PIDs for that program's video, audio, and subtitle tracks. A single TS file from a DVB broadcast might carry 8-12 TV channels simultaneously.

PCR (Program Clock Reference) timestamps embedded every 40 ms synchronize the decoder's clock. This is critical for live broadcast — the receiver has no file duration to reference, so it reconstructs timing entirely from PCR values scattered across the stream.

Real-world performance

TS adds roughly 5-8% overhead compared to bare elementary streams due to packet headers, PSI tables, and null padding packets. A 1080p H.264 broadcast at 15 Mbps allocates approximately 1.0 Mbps to TS overhead. For stored files, this overhead is wasted — MP4's box structure is far more space-efficient for local playback.

HLS (HTTP Live Streaming) segments are TS files. Apple's streaming protocol splits a continuous stream into 2-10 second .ts chunks served over HTTP. Each segment is a self-contained TS file with its own PAT/PMT, so playback can begin at any segment boundary without downloading prior data. MPEG-DASH has largely moved to fragmented MP4 (fMP4), but HLS TS segments remain dominant in deployed infrastructure.

When to use TS vs alternatives

Choose TS for live streaming workflows, broadcast encoding chains, and any scenario where the receiver may join mid-stream. IPTV headends, satellite uplinks, and HLS packaging all require TS. For local file storage, MP4 or MKV are better choices — they offer seeking, chapter markers, and lower overhead.

FileDex converts TS segments to MP4 directly in your browser, re-muxing the elementary streams without re-encoding. The codec data (H.264, H.265, AAC) stays untouched. Conversion typically processes at 80-120 MB/s on modern hardware since no decoding or encoding occurs.

Limitations

TS has no native chapter support, no metadata tagging system, and no subtitle container flexibility — it supports DVB subtitles and teletext but not modern formats like WebVTT or ASS. The format also lacks a global index, so seeking requires scanning PCR timestamps or using an external index file. Files recorded from broadcast often contain null packets used for CBR padding, inflating file sizes by 10-15% beyond the actual content bitrate.

.TS compared to alternatives

.TS compared to alternative formats
Formats Criteria Winner
.TS vs .MP4
Error resilience
TS uses fixed 188-byte packets with sync bytes, allowing decoders to resynchronize after data loss. MP4 relies on a centralized moov atom — if the moov is corrupt or missing, the entire file is unplayable.
TS wins
.TS vs .MKV
Codec flexibility
Matroska supports virtually any codec combination including subtitles, chapters, and attachments. TS is limited to codecs defined in MPEG-2 Systems amendments (H.264, H.265, AAC, AC-3). MKV is the more flexible container for archival purposes.
MKV wins
.TS vs .FMP4
Modern streaming
Fragmented MP4 (CMAF) is replacing TS segments in adaptive streaming. fMP4 works with both HLS and DASH, reduces segment overhead, and supports low-latency streaming modes that TS segments cannot achieve.
FMP4 wins

Technical reference

MIME Type
video/mp2t
Magic Bytes
47 Sync byte 0x47 repeats every 188 bytes.
Developer
ISO / Moving Picture Experts Group
Year Introduced
1995
Open Standard
Yes
0000000047 G

Sync byte 0x47 repeats every 188 bytes.

Binary Structure

MPEG Transport Stream uses fixed 188-byte packets. Each packet begins with a sync byte 0x47 at offset 0. The 4-byte packet header contains: sync byte (8 bits), transport error indicator (1 bit), payload unit start indicator (1 bit), transport priority (1 bit), PID — Packet Identifier (13 bits), transport scrambling control (2 bits), adaptation field control (2 bits), and continuity counter (4 bits). The PID field routes each packet to its program: PID 0x0000 is the PAT (Program Association Table), PID 0x0001 is the CAT (Conditional Access Table), and program-specific PIDs carry video, audio, or data elementary streams. The PAT maps program numbers to PMT (Program Map Table) PIDs, which in turn list the elementary stream PIDs and their types for each program. An optional 204-byte packet variant (188 + 16 bytes Reed-Solomon FEC) is used in DVB systems for forward error correction.

OffsetLengthFieldExampleDescription
0x00 1 byte Sync byte 0x47 Fixed synchronization byte marking the start of each 188-byte packet
0x01 2 bytes Flags + PID 0x4000 Transport error indicator (1 bit), payload unit start (1 bit), priority (1 bit), PID (13 bits)
0x03 1 byte Scrambling + Adaptation + CC 0x10 Scrambling control (2 bits), adaptation field control (2 bits), continuity counter (4 bits)
0x04 184 bytes Payload (variable) Elementary stream data, adaptation field, or both — depending on the adaptation field control bits
1995ISO/IEC 13818-1 (MPEG-2 Systems) published, defining the Transport Stream container format1998DVB (Digital Video Broadcasting) adopts MPEG-TS as its standard transport layer across Europe2005H.264/AVC carriage in MPEG-TS becomes standard, enabling HD broadcasting within existing infrastructure2009Apple introduces HTTP Live Streaming (HLS) using .ts segments, bringing MPEG-TS to web video delivery2013H.265/HEVC support added to MPEG-TS for 4K UHD broadcasting with 50% bitrate reduction over H.2642017MPEG-DASH and fMP4 begin replacing TS segments in adaptive streaming, though HLS retains TS support
Remux TS to MP4 without re-encoding (stream copy) ffmpeg
ffmpeg -i input.ts -c copy -movflags +faststart output.mp4

-c copy performs stream copy — video and audio data transfer to the MP4 container without re-encoding. -movflags +faststart moves the moov atom to the beginning of the file, enabling progressive playback in browsers.

Concatenate multiple HLS .ts segments into one MP4 ffmpeg
ffmpeg -i "concat:segment001.ts|segment002.ts|segment003.ts" -c copy -movflags +faststart output.mp4

The concat protocol joins multiple TS segments in order. Stream copy preserves the original encoding. This is the standard method for reconstructing a full video from HLS segment downloads.

Probe TS file to list streams and codecs ffprobe
ffprobe -show_streams -show_programs -print_format json input.ts

-show_streams lists all elementary streams (video, audio, subtitle) with codec, resolution, bitrate, and PID. -show_programs displays the PAT/PMT program structure. JSON output enables scripted analysis.

Extract audio from TS to AAC ffmpeg
ffmpeg -i input.ts -vn -c:a copy output.aac

-vn disables video output. -c:a copy extracts the AAC audio stream without re-encoding. If the audio is AC-3 or MP2, change the output extension or transcode with -c:a aac.

TS MP4 remux lossless MP4 (ISO BMFF) is the universal playback container supported by HTML5 video, iOS, Android, and all major players. Remuxing from TS to MP4 rewraps the H.264/H.265 streams without re-encoding, preserving full quality at near-instant speed.
TS WEBM transcode lossy WebM with VP9 or AV1 delivers better compression efficiency than H.264 at equivalent quality. Required for projects targeting royalty-free codecs or optimal bandwidth usage on web platforms.
TS GIF transcode lossy Extracting short clips as GIF produces animated images for social media, messaging, and documentation where video embeds are not supported. Quality and color depth are limited to 256 colors per frame.
LOW

Attack Vectors

  • Malformed packet headers: crafted TS packets with invalid PID or adaptation field values can trigger buffer overflows in poorly validated demuxers
  • Oversized adaptation fields: adaptation field length exceeding 183 bytes causes out-of-bounds reads in vulnerable parsers
  • Embedded subtitle injection: teletext or DVB subtitle streams can contain escape sequences that affect terminal-based players

Mitigation: FileDex processes TS files locally using FFmpeg WASM in a sandboxed browser environment. No packets are sent to external servers. The WASM sandbox prevents any file system or network access outside the browser tab.

FFmpeg tool
Universal multimedia framework for decoding, encoding, muxing, and streaming TS files
VLC tool
Cross-platform media player with built-in MPEG-TS demuxer and network streaming
GStreamer library
Pipeline-based multimedia framework with tsdemux and tsparse elements
hls.js library
JavaScript HLS client that demuxes TS segments and feeds them to MSE in browsers
GPAC / MP4Box tool
Multimedia packager supporting TS to fMP4 conversion for DASH and HLS workflows