← Blog.backToBlog

How to Download M3U8 Using Wget and Curl

6 min read

Why Use Wget or Curl?

Wget and curl are universal HTTP clients. For M3U8 they shine when you need to inspect a playlist, download raw segments, or script checks. They do not merge segments into a playable MP4 — for that use FFmpeg or our online downloader.

Downloading the Playlist File

# wget
wget "https://example.com/stream.m3u8"
# curl
curl -L -O "https://example.com/stream.m3u8"

Open the file in a text editor to study tags and segment URLs. Reading guide: read M3U8 as text.

Downloading All Segments

wget "https://example.com/stream.m3u8"
grep -v "^#" stream.m3u8 | grep -v "^$" | while read url; do
  case "$url" in
    http*) wget "$url" ;;
    *) wget "https://example.com/$url" ;;
  esac
done

Then merge with FFmpeg concat. Related: merge TS with FFmpeg.

Curl + FFmpeg Combo

# Check availability
curl -I "https://example.com/stream.m3u8"
# Full download + merge
ffmpeg -i "https://example.com/stream.m3u8" -c copy output.mp4

This is the practical workflow: curl for probes, FFmpeg for real downloads.

Limitations

  • No adaptive quality selection logic.
  • No automatic AES handling like FFmpeg.
  • Easy to miss relative URL bases.
  • Poor live-edge tracking compared to players/downloaders.

Frequently Asked Questions

Can wget download a full HLS video alone?
It can fetch files, but not produce a clean merged MP4 by itself.

Should I use curl or FFmpeg?
Curl for inspection; FFmpeg for complete download/merge.

How do I download just the playlist?
curl -L -O url.m3u8

Is there a no-CLI option?
Yes — our browser downloader.