Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HLS segment (.ts) internal format

I try to understand how HLS segmenter converts MPEG-TS packets into HLS chunks. Does HLS chunk incapsulates several MPEG-TS packets, or it's a completely different format and differs from MPEG-TS? For example, can I retrieve PCR (Program Clock Reference) or other MPEG-TS specific data?

like image 992
Phargelm Avatar asked Oct 23 '25 14:10

Phargelm


1 Answers

According to the spec:

Each Media Segment MUST be formatted as an MPEG-2 Transport Stream [ISO_13818], a WebVTT [WebVTT] file, or a Packed Audio file ...

In other words: HLS is built on top of MPEG-TS. Video is always formatted as an MPEG Transport Stream. Subtitles use WebVTT. Audio can formatted either as an MPEG-TS or raw AAC/MP3 frames.

When video/audio is formatted as MPEG-TS, each HLS segment is self contained (i.e. contains all necessary decoding information) and consists of many MPEG-TS packets (an MPEG-TS packet is just 188 bytes).

Yes, you can retrieve PCR and everything else that's embedded in the MPEG-TS, for instance ID3 metadata, other multiplexed streams, CEA 608/708 and so on.

The next version of HLS will allow fragmented MP4 to be used as an alternative to MPEG-TS for video/audio but at the moment support is limited.

like image 58
Svetlin Mladenov Avatar answered Oct 25 '25 19:10

Svetlin Mladenov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!