Back to Notes
til
system-design
video-streaming
hls
dash
cdn

How HLS / DASH Actually Work (Under the Hood)

December 23, 2025
Share:TwitterLinkedIn

Most people describe HLS/DASH as “adaptive bitrate streaming” and stop there.
That explanation is technically correct, but it hides the real elegance of the system.

At its core, HLS/DASH are not streaming protocols in the traditional sense.
They are file-based delivery systems built on top of plain HTTP.


The Core Idea

Instead of sending one long, continuous video stream over a persistent connection, HLS/DASH break a video into many small, independently playable files (segments).

The client decides which file to download next.

No sockets.
No server-side session state.
No per-viewer stream.

Just files.


From Video to Segments

A video (VOD or live) is first encoded into multiple bitrates:

  • 360p
  • 720p
  • 1080p

Each bitrate version is then split into small segments, usually 2–6 seconds long.

Key properties of segments:

  • Each segment starts with a keyframe
  • All bitrates are time-aligned
  • Each segment is independently decodable

You end up with something like:

/360p/segment_001.ts
/360p/segment_002.ts
/720p/segment_001.ts
/720p/segment_002.ts

This alignment is what makes seamless quality switching possible.


The Playlist / Manifest Is the Brain

The video itself is never streamed directly.

The client first downloads a playlist (HLS) or manifest (DASH).

This file:

  • Lists available bitrates
  • Points to segment URLs
  • Defines segment durations
  • Indicates whether the stream is live or VOD

In HLS, this is a .m3u8 file.
In DASH, it’s a .mpd.

Think of it as an index, not content.


What Actually Happens During Playback

A simplified playback flow looks like this:

  1. Client fetches the master playlist
  2. Client chooses an initial bitrate based on:
    • Network conditions
    • Device capability
  3. Client fetches the media playlist for that bitrate
  4. Client downloads segments one by one
  5. While playing, the client continuously:
    • Measures download speed
    • Tracks buffer health
    • Decides whether to switch quality

Crucially:

The server is never involved in quality decisions.


Adaptive Bitrate Is Just Smart URL Selection

There’s no renegotiation and no protocol-level signaling.

If the network improves:

GET /720p/segment_004.ts

If it degrades:

GET /360p/segment_004.ts

Because segments are aligned and start with keyframes, playback continues smoothly.

This simplicity is intentional — it makes retries, fallbacks, and scaling trivial.


Live Streaming Is “VOD in Motion”

Live streaming uses the same mechanism.

The difference:

  • The playlist keeps growing
  • Old segments drop off (sliding window)
  • The client polls the playlist periodically

A live playlist is effectively saying:

Here are the latest segments available right now.

Latency is not caused by the protocol itself.
It comes from:

  • Segment size
  • Playlist refresh interval
  • Client buffer depth

Smaller segments reduce latency but increase overhead.


Why This Scales So Well

HLS/DASH scale because of what they don’t do:

  • No per-user server state
  • No persistent streaming connections
  • No backend fanout

Everything is:

  • Stateless
  • Cacheable
  • CDN-friendly

Once segments hit the CDN edge, the backend is completely out of the hot path.
Millions of viewers can watch the same video without the origin even noticing.

Share:TwitterLinkedIn