Skip to content

A CLI m3u8-downloader program to parse .m3u8 playlist file and download mpeg2-ts video files, concat them and convert it to mp4 using FFMPEG

License

Notifications You must be signed in to change notification settings

arlessweschler/m3u8-dl

 
 

Repository files navigation

m3u8-dl

forthebadge forthebadge forthebadge forthebadge made-with-python
MIT license PyPI version Docker CodeQL Upload Python Package Downloads

a CLI program to download videos in a m3u8 playlist, write it to a single video file and convert it to mp4 using ffmpeg. Read about m3u8 here https://en.wikipedia.org/wiki/M3U#M3U8

Dependencies

Usage

Setup without docker

  • clone the repository using git clone "ssh/https url".
  • create a virtual environment using virtualenv -p python3.6 venv in linux terminal, see 'Dependencies' for platform specific instructions.
  • activate virtual environment using source venv/bin/activate in linux terminal, see 'Dependencies' for platform specific instructions.
  • install dependencies using pip install -r requirements.txt.
  • set USE_CYTHON = True in setup.py
  • compile shared libraries using python setup.py build_ext --inplace.
  • insert the url request headers in headers.txt.
  • start the script using python -m m3u8dl <url of playlist>.

Setup with docker

  • build docker image using docker build -t m3u8dl:0.11 .
  • start container docker run -d -it --entrypoint='bash' --name m3u8dl-app m3u8dl:0.11
  • go into container terminal docker exec -it m3u8dl-app bash

Installing/Uninstalling

for installation and usage using pip:-

  • ensure ffmpeg is installed see dependecies section
  • visit PyPI https://pypi.org/project/m3u8dl/0.1.1/ or install using below commands.
  • run pip install m3u8dl==0.1.1
  • run the program now using python -m m3u8dl <url-of-playlist>

for uninstalling using pip:-

  • run pip uninstall m3u8dl

for installation in ubuntu using PyInstaller:-

  • activate virtualenv using source venv/bin/activate
  • run pyinstaller main.py --name m3u8-dl --onefile -p venv/lib/python3.6/site-packages/ in terminal.
  • run sudo mv dist/m3u8-dl /usr/local/bin/ in terminal window.
  • now that the program is installed globally you can start the program using m3u8-dl in the terminal

for uninstalling in ubuntu:-

  • run sudo rm /usr/local/bin/m3u8-dl

CLI Options

--help, -h:- display how to use the script
--convert, -c:- specify this flag to convert the video to mp4 using ffmpeg`
--name, -n:- specify the name by which to save the downloaded video, else 'video' is chosen as default name`
--header-path, -p:- specify the path of header file`
--retry, -r:- specify number of retries, by default 5 retries will be initiated
--debug, -d:- print helpful messages to console to understand program flow
--processes, -m:- specify custom number of processes, default is 4
--threads, -t:- specify custom number of threads, default is 4 per process

About

A CLI m3u8-downloader program to parse .m3u8 playlist file and download mpeg2-ts video files, concat them and convert it to mp4 using FFMPEG

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Python 99.2%
  • Dockerfile 0.8%