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.
ملفاتك لا تغادر جهازك
أسئلة شائعة
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.
ما يميز .TS
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.
اكتشف التفاصيل التقنية
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 إلى...
المرجع التقني
- نوع MIME
video/mp2t- Magic Bytes
47Sync byte 0x47 repeats every 188 bytes.- المطوّر
- ISO / Moving Picture Experts Group
- سنة التقديم
- 1995
- معيار مفتوح
- نعم
Sync byte 0x47 repeats every 188 bytes.
البنية الثنائية
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.
| Offset | Length | Field | Example | Description |
|---|---|---|---|---|
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 |
نقاط الضعف
- 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
الحماية: 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.