How to download and decrypt HTTP Live Streaming (HLS) videos in iOS?

This Perl script is a good fetcher: https://github.com/osklil/hls-fetch

Steps:

wget https://raw.githubusercontent.com/osklil/hls-fetch/master/hls-fetch
chmod +x hls_fetch
./hls_fetch --playlist "THE_URL"

Replace THE_URL with the full URL of your M3U8 playlist (or try other options with --help).

Bonus: If you have missing Perl's JSON module (as I had), simply run sudo cpan JSON.


You can use ffmpeg to download and decode the HTTP-LS stream:

ffmpeg -i http://example.org/playlist.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4

There is an iOS version of ffmpeg available.