Download Streams

This is my tentative work flow for downloading movie streams online. The gist of what I've learned about this process is that every HTTP Live Stream (HLS) begins with an .m3u8 playlist with a MIME type of x-mpegURL or vnd.apple.mpegURL. This playlist lists a series of .ts files that are streamed one at a time and decoded so your browser is not burdened with downloading the entire movie every time you refresh the page. These .ts files can also be aggregated and assembled into a video.

Finding the Playlist

`.m3u8` playlists load at the very beginning of the stream and are easy to spot in Firefox Developer Edition. Navigate to the stream, press F12, click on the "Network" tab and refresh the page.

In this first example we see the .m3u8 playlist referred to as a Manifest. It sticks out in Firefox Developer Edition because the MIME type is vnd.apple.mpegURL. In Edge or Chrome this type will be something nondescript for some reason and the playlist will be much harder to spot. Right-click on the GET request for the playlist copy the URL, and you will have something like this:

1https://cdn-ce21media.streaming.mediaservices.windows.net/REDACTED/20220518_day1dbt_baxermusser8460.ism/QualityLevels(1194234)/Manifest(video,format=m3u8-aapl-v3,audiotrack=aac_UND_2_56)

You'll know you're on the right track if you open a downloaded .m3u8 file in Notepad++ and it looks something like this:

 1#EXTM3U
 2#EXT-X-VERSION:3
 3#EXT-X-PLAYLIST-TYPE:VOD
 4#EXT-X-ALLOW-CACHE:NO
 5#EXT-X-MEDIA-SEQUENCE:0
 6#EXT-X-TARGETDURATION:6
 7#EXT-X-PROGRAM-DATE-TIME:1970-01-01T00:00:00Z
 8#EXTINF:6.000000,no-desc
 9Fragments(video=0,format=m3u8-aapl-v3,audiotrack=aac_UND_2_56)
10#EXTINF:6.000000,no-desc
11Fragments(video=60000000,format=m3u8-aapl-v3,audiotrack=aac_UND_2_56)
12#EXTINF:6.000000,no-desc
13Fragments(video=120000000,format=m3u8-aapl-v3,audiotrack=aac_UND_2_56)
14#EXTINF:6.000000,no-desc
15Fragments(video=180000000,format=m3u8-aapl-v3,audiotrack=aac_UND_2_56)
16#EXTINF:6.000000,no-desc
17
18...
19
20Fragments(video=249540000000,format=m3u8-aapl-v3,audiotrack=aac_UND_2_56)
21#EXT-X-ENDLIST

This URL can then be fed into ffmpeg like so and you will have successfully downloaded the stream:

1ffmpeg -i "https://cdn-ce21media.streaming.mediaservices.windows.net/REDACTED/20220518_day1dbt_baxermusser8460.ism/QualityLevels(1194234)/Manifest(video,format=m3u8-aapl-v3,audiotrack=aac_UND_2_56)" movie.mp4

image

Here is an example of a stream that the content host was trying to protect. The file is plainly named v.m3u8 and the MIME type is vnd.apple.mpegURL. However, when we look at the playlist itself the fragments are obfuscated as .jpg files.

 1#EXTM3U
 2#EXT-X-VERSION:3
 3#EXT-X-MEDIA-SEQUENCE:0
 4#EXT-X-ALLOW-CACHE:YES
 5#EXT-X-TARGETDURATION:4
 6#EXTINF:3.083333,
 70000.jpg
 8#EXTINF:3.000000,
 90001.jpg
10#EXTINF:3.000000,
110002.jpg
12#EXTINF:3.000000,
130003.jpg
14#EXTINF:3.000000,
150004.jpg
16#EXTINF:3.000000,
170005.jpg
18#EXTINF:3.000000,
190006.jpg
20#EXTINF:3.000000,
210007.jpg
22
23...
24
25#EXTINF:2.250000,
261898.jpg
27#EXT-X-ENDLIST