WARNING

I failed to come up with an a way to do this in yt-dlp. Project ABANDONED.

INFO

As an alternative, maybe try https://github.com/merasugd/m3u8-dl

I want to download the fragments of a m3u8 livestream playlist. Not the mp4, just the fragments.

How do I do that? I couldn’t find an answer online so I did a bunch of trial and error to find out how to do it.

We’re going to use yt-dlp and aria2c. yt-dlp will scrape the website and get the m3u8 playlist, while aria2c will download the fragments.

Here’s an example where I succeeded in downloading all the fragments from a video.js test video.

yt-dlp --external-downloader aria2c --keep-fragments --write-playlist-metafiles --no-part https://stream.mux.com/BV3YZtogl89mg9VcNBhhnHm02Y34zI1nlMuMQfAbl3dM.m3u8

This works for a static m3u8 file, but not for a livestream.

I found a relevant issue on github https://github.com/yt-dlp/yt-dlp/issues/11766