Guides

What is an M3U8 (HLS) stream, and how do you save it as one MP4?

Why some videos have no single file to download. How HLS and M3U8 playlists work, what DASH is, how encrypted segments are handled and how to join them.

Key takeaways

  • A lot of web video is not one file. It is a playlist (.m3u8 for HLS, .mpd for DASH) pointing at hundreds of short segments.
  • Saving it means downloading every segment and joining them, usually without re-encoding.
  • Some HLS streams are encrypted with AES-128. That is different from DRM, and the key is part of the playlist.
  • Streams protected by DRM, such as Widevine, cannot and should not be saved.

Why some videos have no download link

Open a video on a site, right-click and you will often find no "Save video as". That is because the page is not playing a single .mp4. It is playing an adaptive stream, a method designed so that a video can switch quality while you watch, depending on your connection.

Instead of one big file, the video is cut into small segments, usually a few seconds each. A text file called a playlist or manifest lists the segments in order. Your player reads it and fetches them one by one.

HLS and M3U8

HLS stands for HTTP Live Streaming, a format created by Apple that is now used almost everywhere. Its playlists have the extension .m3u8. There are two levels:

  • Master playlist. Lists the available qualities (variants), each with a bandwidth and often a resolution, and links to a playlist for each.
  • Media playlist. Lists the segments for one quality, typically .ts files or fragmented MP4 pieces, with their durations.

The player picks a variant, then keeps fetching segments. If your network slows, it switches to a lower variant.

DASH and MPD

DASH (Dynamic Adaptive Streaming over HTTP) does the same job with a different manifest, an XML file ending in .mpd. The ideas are the same: several qualities, many segments, a player that adapts.

Encrypted segments: AES-128 versus DRM

This distinction trips many people up.

  • AES-128 HLS encryption. The playlist contains a line such as #EXT-X-KEY pointing at a key URL. A player downloads the key and decrypts segments. The key is delivered openly to anyone who can load the playlist, so a normal downloader can follow the same steps and join the result.
  • DRM. Systems such as Widevine, PlayReady and FairPlay do not hand the key to the page. The decryption happens inside a protected module of the browser or device. A downloader cannot, and should not, get around it.

TurboGet handles AES-128 HLS, but detects DRM key formats and refuses. Pages that play protected video are marked Protected. See what DRM is and why downloaders can't bypass it.

How a stream becomes one MP4

Saving a stream is a three-step process:

  1. Parse the playlist. Read the master playlist, pick a quality and read its media playlist, including any initialization segment (EXT-X-MAP), byte ranges and encryption keys.
  2. Download the segments. There can be hundreds or thousands, so fetching them in parallel makes a large difference. TurboGet fetches parts 16 at a time.
  3. Join them. The segments are concatenated and put into an MP4 container. With a tool such as ffmpeg and the -c copy option, this copies the video and audio as they are, with no re-encoding, so it is fast and loses no quality.

Live streams

A live HLS playlist has no end: new segments keep appearing. A downloader can save what is available at the moment you click, but recording a live broadcast as it continues is a different feature. TurboGet currently saves only the part available when you click.

Choosing the quality

With adaptive streams you pick a variant before you download, not after a 2 GB file arrives. TurboGet lists each HLS quality it finds, plus direct MP4 files, so you can choose 1080p, 720p or audio only first.

Is it legal?

Downloading is subject to the site's terms and copyright law where you live. Save content you own, content that is freely licensed or content the rightsholder allows. Nothing here is legal advice.

Frequently asked questions

What is an M3U8 file?

It is a text playlist used by HLS. It lists video segments or other playlists in the order a player should fetch them. By itself it contains no video.

Why can't I just download the .m3u8 file?

Because it is only the list. The actual video is in the segments it points to. You need a tool that downloads all of them and joins them.

Can I download Netflix or Prime Video this way?

No. Those services use DRM, not simple AES-128 encryption. A legitimate downloader will mark them as protected and stop.

TurboGet downloads HLS and DASH streams with its own parallel engine and joins them into one MP4.

See TurboGet