The transport packet is always 188 bytes, but files and links frame it in three ways. The explorer
tells them apart by the stride at which the sync byte 47 repeats, and reads each as a variant
of the same format.
The three framings
| Variant | Record | Where the sync byte is | Used for |
|---|---|---|---|
| MPEG-TS | 188 bytes | Offset 0 of each record | Broadcast recordings, HLS segments, most .ts files |
| BDAV (M2TS) | 192 bytes | Offset 4 of each record | Blu-ray .m2ts files in BDMV/STREAM, AVCHD camcorder .mts and .m2ts clips |
| With Reed-Solomon parity | 204 bytes | Offset 0 of each record | Captures taken before the demodulator's outer decoder strips the parity, and some professional recorders |
BDAV: TP_extra_header
Each packet of a BDAV stream is preceded by four bytes.
| Bits | Name | Meaning |
|---|---|---|
| 2 | copy_permission_indicator | 00 copying free; 01, 10 restricted; 11 copying prohibited. |
| 30 | arrival_time_stamp | The time the packet arrived at the recorder, in ticks of 27 MHz. The counter wraps every 39.8 seconds. |
Playing a BDAV stream means releasing each packet at its arrival time, which reproduces the original bit rate and jitter. The explorer shows the header as the first node of every packet and, on the Stream tab, the first and last timestamp.
Blu-ray and AVCHD streams use user private stream types in the PMT: 80 HDMV LPCM audio, 81 AC-3, 82 DTS, 83 Dolby TrueHD, 84 Dolby Digital Plus, 85 DTS-HD High Resolution, 86 DTS-HD Master Audio, 90 presentation graphics (subtitles), 91 interactive graphics (menus), 92 text subtitles, A1 and A2 secondary audio, EA VC-1. The registration descriptor HDMV in the PMT marks them. See Stream types.
204-byte packets
Sixteen bytes of Reed-Solomon parity follow each 188-byte packet. The code is RS(204,188) over GF(256) with field polynomial x8+x4+x3+x2+1 and generator roots 20 to 215 (a shortened RS(255,239)), and it can correct up to eight wrong bytes. The explorer computes the sixteen syndromes of every packet: all zero means the packet is a correct code word. Failures are counted on the Stream tab and marked in the packet tree; the bytes are not corrected.
How the explorer decides
- A file is claimed as a transport stream only when its first three packets all start with
47at an exact stride of 188, 192 (the first at offset 4) or 204. The.tsextension is also TypeScript and Qt translation source, and a file that fails the test is read as those. - A file that passes and later loses sync is still a transport stream: the damaged bytes become their own node and the stream is picked up again at the next place where three sync bytes follow each other at the stride.
- A stream that starts with unrelated bytes is found by looking for that run of sync bytes in the first 8 KB.
Not described
Known, not yet covered
- Viewer: the BDAV directory structure (index.bdmv, MovieObject.bdmv, PLAYLIST and CLIPINF files, the CPI in clip information) is not read; only the stream files are. The timecode-based packet timestamps of other 192-byte recorders (DVB-T2 and professional formats that put a different header before the packet) are shown as the same two fields.
- Viewer: Reed-Solomon errors are detected but not corrected.