Skip to main content

a cli program to download video at m3u8 url

Project description

m3u8downloader is a tool to download video at a m3u8 link. HTTP Live Streaming (HLS) is becoming popular. m3u8 playlist is used by HLS to serve video fragments of different quality to different clients. This tool supports HLS master playlist and media playlist. If master playlist is given, it selects the highest resolution automatically. HLS fragment encryption is supported. Resume from partial download is supported, just rerun the same command to continue.

ffmpeg is used to convert the downloaded fragments into final mp4 video file.


To install m3u8downloader, simply:

$ sudo apt install -y ffmpeg
$ pip install --user m3u8downloader

Quick Start

Example command line usage:

downloadm3u8 -o ~/Downloads/foo.mp4

If ~/.local/bin is not in $PATH, you can use full path:

~/.local/bin/downloadm3u8 -o ~/Downloads/foo.mp4

Here is built-in command line help:

usage: m3u8downloader [-h] [--version] [--debug] --output OUTPUT
                      [--tempdir TEMPDIR] [--concurrency N]

download video at m3u8 url

positional arguments:
  URL                   the m3u8 url

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --debug               enable debug log
  --output OUTPUT, -o OUTPUT
                        output video filename, e.g. ~/Downloads/foo.mp4
  --tempdir TEMPDIR     temp dir, used to store .ts files before combing them
                        into mp4
  --concurrency N, -c N
                        number of fragments to download at a time


This command line tool doesn’t have extra documents.


This tool only parses minimum m3u8 extensions for selecting media playlist from master playlist, downloading key and fragments from media playlist. If a m3u8 file doesn’t download correctly, it’s probably some new extension was added to the HLS spec which this tool isn’t aware of.


  • v0.8.0 2019-03-31
    • add logrotate for log handler
  • v0.7.8 2019-03-09
    • bugfix: fragment url rewrite fail for some cases
  • v0.7.7 2019-03-08
    • bugfix: always rewrite fragment url to local abs path
  • v0.7.5 2019-03-07
    • set default log level to INFO
  • v0.7.4 2019-03-07
    • initial release

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for m3u8downloader, version 0.8.0
Filename, size File type Python version Upload date Hashes
Filename, size m3u8downloader-0.8.0-py2.py3-none-any.whl (10.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size m3u8downloader-0.8.0.tar.gz (8.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page