Skip to main content

Python downloader for saving m3u8 video to local MP4 file.

Project description

https://img.shields.io/pypi/v/m3u8-To-MP4?style=flat-square:alt:PyPI

M3u8-To-MP4

Python downloader for saving m3u8 video to local MP4 file.

QuickStart

Install m3u8_To_MP4 via pip

  1. 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.

  2. 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

  1. Treat ffmpeg as a system service to achieve cross-platform.

  2. If ffmpeg is not found, archiving is also supported. (v0.1.3 new features)

  3. Resume from interruption. (based on crc32 temp directory path)

  4. Use system tmp folder.

  5. Concurrent requests based on the thread pool.

  6. Concurrent requests based on efficient coroutines (v0.1.3 new features).

  7. 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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

m3u8_To_MP4-0.1.7-py3-none-any.whl (26.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page