RTVSLO stream downloader

User manual/instructions for the RTVSLO live stream downloader

Source code

You can get the source code here.
If you encounter an issue/bug, feel free to open an issue here.

Setup

To install all necessary libraries run pip install -r requirements.txt

Downloading

To download a stream you need an URL template. You can get it by following those steps:

  1. open the stream
  2. open developer tools
  3. click on the “Network” tab
  4. wait until an entry with a .ts file extension appears
  5. replace the number (counter) before the .ts with %s

You have successfully generated your URL template.

Example

Example screenshot of developer tools network log:

description

In this case, the URL is https://rtvslolive.akamaized.net/hls/live/584144/tv_slo1/slo1_360p/6p4b4hy7/00000003/media_6618.ts.

After you replace the counter with %s, you get https://rtvslolive.akamaized.net/hls/live/584144/tv_slo1/slo1_360p/6p4b4hy7/00000003/media_%s.ts, which is your URL template.

Multithreaded downloader

Multithreaded downloader supports the following options:

  • -s (required) - the live stream URL template
  • -z (default: 4) - how many places does the URL file template counter have
  • -d (default: 0) - the default counter setting. If the stream doesn’t start at the specify number, the system will increment the counter until it reaches the beginning of the stream
  • -c (default: mt_chunks/) - output directory for the ts chunks
  • -l (defualt: mt_logs/) - output directory for the logs
  • -m (default: 10) - number of threads used for downloading

Singlethreaded downloader

Singlethreaded downloader supports the following options:

  • -s (required) - the live stream URL template
  • -z (default: 4) - how many places does the URL file template counter have
  • -d (default: 0) - the default counter setting. If the stream doesn’t start at the specify number, the system will increment the counter until it reaches the beginning of the stream
  • -c (default: chunks/) - output directory for the ts chunks
  • -l (defualt: logs/) - output directory for the logs

Merging downloaded chunks

To merge all downloaded chunks into a single mp4 file run:

  • If you used multithreaded downloader: ./mt_merge_ts.sh
  • If you used singlethreaded downloader: ./merge_ts.sh

The output files will be located in output folder.

Please note: you must have ffmpeg installed in order to use the merging script.

License

MIT