Python downloader for saving m3u8 video to local MP4 file.
Project description
M3u8-To-MP4
Python downloader for saving m3u8 video to local MP4 file.
QuickStart
Install m3u8_To_MP4 via pip
Preparation: configure ffmpeg. (e.g., Win10)
Download “release full” build. It will have the largest set of libraries with greater functionality.
Extract the contents in the ZIP file to a folder of your choice.
To add FFmpeg to Win10 path. (User variables -> Path -> New and add)
Verify. Open the Command Prompt or PowerShell window, type ffmpeg, and press Enter.
Installation: m3u8_To_MP4
pip install m3u8_To_MP4
Download a mp4 vidoe from a m3u8 uri
There are two options to download a m3u8 video into a mp4 file: async and multi-threads.
Asynchronous downloader (recommend)
import m3u8_to_mp4
if __name__ == '__main__':
m3u8_to_mp4.async_download('http://videoserver.com/playlist.m3u8')
Multi-thread downloader
import m3u8_to_mp4
if __name__ == '__main__':
m3u8_to_mp4.multithread_download('http://videoserver.com/playlist.m3u8')
# For compatibility, i reserve this api, but i do not recommend to you again.
# m3u8_to_mp4.download('http://videoserver.com/playlist.m3u8')
Resuming
If you use default tmp dir, resuming the transfer from the point of interruption will be executed automatically (based on crc32 hashing).
Features
Treat ffmpeg as a system service to achieve cross-platform.
If ffmpeg is not found, archiving is also supported. (v0.1.3 new features)
Resume from interruption. (based on crc32 temp directory path)
Use system tmp folder.
Concurrent requests based on the thread pool.
Concurrent requests based on efficient coroutines (v0.1.3 new features).
The retry strategy is carried out collectively after the whole cycle is repeated, avoiding the problem of short retry interval.
TODO
Catch exceptions during decryption. (Done)
Align asynchronous implementation with multi-threads. (Done)
Errors: application data after close notify.
Extract independent asynchronous http package.
Support IPv6.
Compare ffmpeg/avconv/mencoder/moviepy.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for m3u8_To_MP4-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2b1b1bd21d6f46cf070f45bcc3a59a3a5f75f6162e1eb2c03335e51c3f465f5 |
|
MD5 | 786b069b36e2c7476b996415497585e3 |
|
BLAKE2b-256 | 1627e0c081062c8c857a7157d274f3e883e21ae84faf1c45d1585287eeff367a |