MPEG-TS, used in broadcasting and early HLS, was designed on the assumption of a never-ending stream, not a file.
MPEG-TS (Transport Stream) is a container designed for broadcast transmission. It has no index for the whole file; instead it keeps sending small packets of equal size so that it can be read no matter where you start receiving. That character is also why early HLS used this format for its segments (HLS and DASH).
0x47. Even if you start receiving in the middle, you can find this byte and realign the packet boundaries.A receiver first reads the PAT (Program Association Table), which arrives on PID 0, to learn the list of programs and where each program's PMT is. From the PMT (Program Map Table) it learns which PID carries the video and which the audio, and which codecs they use. Because these tables are sent repeatedly, a receiver that tunes in mid-stream can work out the structure soon after.
Video and audio data are wrapped into PES packets, then cut into 188-byte pieces and carried in TS packets. The PES header holds the PTS and DTS (next lesson), and these values are in units of a 90 kHz clock. In addition, the PCR (based on 27 MHz), which carries the sender's reference clock, is transmitted at regular intervals so the receiver can synchronize its clock.
"Larger overhead" describes the direction implied by the structure; the exact ratio varies by stream.
Because TS packets are independent, simply joining two TS files end to end often plays back (though the timestamps are discontinuous, so the player has to handle that). Thanks to this property, TS has long been used for editing broadcast recordings and for joining HLS segments. Still, new streaming today is largely moving toward fMP4 (CMAF) (CMAF).
A broadcast container that streams fixed 188-byte packets, distinguished by PID.
A 13-bit value in the TS packet header. It indicates which stream the packet belongs to.
Tables where the PAT gives the program list and the PMT locations, and the PMT gives each stream's PID and type.
A value that carries the sender's reference clock to the receiver. Based on 27 MHz.
In MPEG-TS, how does a receiver find out which PID is the video and which is the audio?