Download the ts files according to the given m3u8 file.
m3u8_downloader.py [-h] [-t TIMEOUT] [--ffmpeg-path FFMPEG_PATH]
[--ffmpeg-loglevel FFMPEG_LOGLEVEL] [-o OUTPUT] [-y] uri
positional arguments:
uri URI of the m3u8 file
optional arguments:
-h, --help show this help message and exit
-t TIMEOUT, --timeout TIMEOUT
timeout used when loading from uri (default None)
--ffmpeg-path FFMPEG_PATH
path to ffmpeg executable (default ffmpeg)
--ffmpeg-loglevel FFMPEG_LOGLEVEL
logging level of ffmpeg (default quiet)
-o OUTPUT, --output OUTPUT
path to output (default output.ts)
-y, --overwrite overwrite output files without asking
-
ffmpy: https://github.com/Ch00k/ffmpy - A simplystic FFmpeg command line wrapper.
-
m3u8: https://github.com/globocom/m3u8 - Python m3u8 parser.
-
ffmpeg: https://ffmpeg.org/ - Used to download, convert and merge the downloaded ts files.
- use chrome to search m3u8 from the video
- python m3u8_downloader.py https://baikevideo.cdn.bcebos.com/media/mda-OgJZ5meZEwxyMv5u/e5ee1c791e1ec62761cdf1a852435611.m3u8
- get the file from current folder
- convert the file into mp4
ffmpeg -i output.ts -bsf:a aac_adtstoasc -acodec copy -vcodec copy video.mp4
ffmpeg -i output.ts -bsf:a aac_adtstoasc -acodec copy -vcodec copy -ss 00:00:23 -to 00:00:44 video.mp4