public
Authored by avatar s-tier

Ripping HLS streams with aria2 and ffmpeg

Edited
GUIDE.md 2.14 KiB

Guide to ripping HLS streams using aria2 and ffmpeg

Dependencies:

  1. Download and install FFMPEG
  2. Download and install aria2.

Setup:

  1. Create a folder for the movie you want (i.e. pppd-369)
  2. Open up the web player for the movie.
  3. Click F12 on your keyboard. (opens Developer Tools)
  4. Switch the streaming bitrate from AUTO to 6000kbps.
  5. Go to the Network Tab in dev tools and search filter for .m3u8.
  6. Download the chunklist_b6000000 file by right clicking and open in new tab.
  7. Save it to the folder as index.m3u8.
  8. Now filter for mobile (or drm_iphone) and download the file. This is important for decrypting the ts files we will download soon.
  9. Open up index.m3u8 in VS Code or your favorite text editor.
  10. Edit the URI to simply be mobile or drm_iphone (the file we downloaded above).

Your file should look like this at the top:

#EXT-X-KEY:METHOD=AES-128,URI="mobile"
#EXTINF:10.0,
media_b6000000_0.ts
#EXTINF:10.0,
media_b6000000_1.ts
#EXTINF:10.0,
media_b6000000_2.ts
#EXTINF:10.0,
...
  1. Save the file.
  2. Lastly, note the number of the last _#.ts file at the bottom of index.m3u8. Let's call it END_TS.

Download via aria2:

  1. Back in your network tab filter for .ts and highlight the request URL for any of your matches.
  2. Copy the string up until media_b6000000_ and paste in your notes then concatenate with [0-END_TS].ts.

Example:

http://limst-video7.*.com*/media_b6000000_[0-1770].ts
  1. Next, open up your command line terminal and cd into the folder with the m3u8 file. Run the following command with the URL we created above.

aria2c -P -Z -c -x 5 -j 5 <URL>

This will open 5 connections at a time and download each individual ts file listed in the m3u8 file.

  1. Once complete run the following command to join and decrypt the ts files into one mkv file that we will save outside the folder so we can easily find it when complete:

ffmpeg -allowed_extensions ALL -i index.m3u8 -c:v copy -c:a copy ../pppd-369.mkv

And that's everything.

Please register or to comment