m3u8toMP3
Based on asvatov/m3u82mp3 simple module, the program converts m3u8 audio streams to MP3 files.
Key features:
- Asynchronous (asyncio)
- Can be used both with terminal (bash, cmd) and inside your python scripts.
- Can work with URLs, local paths to your M3U8 files and with raw bytes objects inside your scripts.
- ffmpeg tends to cut the beginning and the ending of streams when converting to MP3, the script fixes this issue.
Dependencies
The script requires ffmpeg to be installed on your system.
You can install it using following commands:
MacOS:
brew install ffmpeg
Debian/Ubuntu:
apt update && apt upgrade
apt install ffmpeg
For Windows and other OS, please refer to the according tutorial on the internet.
To make sure the ffmpeg was installed properly, execute the following command in your terminal:
ffmpeg -h
If you get any errors ("command not found: ffmpeg", for example) then something went wrong during ffmpeg installation. Please try reinstalling or find help on the Internet.
Installation and usage as an executable
Download the latest release from the Releases page. For example:
curl -o m3u8toMP3 https://github.com/Suoslex/m3u8toMP3/releases/download/0.1.1/m3u8toMP3_0.1.1_linux
Give execute permissions to the binary:
chmod +x ./m3u8toMP3
Use the following syntax to convert your m3u8 files to MP3. You can use both URLs and local paths:
./m3u8toMP3 "https://some-site.com/file.m3u8"
./m3u8toMP3 "<path/to/file.m3u8"
If you want to specify a name for the output MP3 file, add one more argument to the command:
./m3u8toMP3 "<path/to/file.m3u8" "./output.mp3"
If you want to use the program without directory path, you can, for example, append PATH variable with the current path, or move the binary to /usr/local/bin:
mv ./m3u8toMP3 /usr/local/bin/m3u8toMP3
And then you can run the program anywhere:
m3u8toMP3 "https://some-site.com/index.m3u8"
Installation and usage as a python script
Install the package using your favorite package manager. For example, using pip:
pip install m3u8toMP3
To run the script from the command line, use the following syntax:
python -m m3u8toMP3 "<path_to_m3u8_file>" "<path_to_save_mp3_file"
To use the script in your code, you need to import the convert_m3u8_to_mp3 function:
from m3u8toMP3 import convert_m3u8_to_mp3
...
async def main():
await convert_m3u8_to_mp3("path/to/file.m3u8", "path/to/output.mp3")
...
If you want to work with in-memory bytes objects, use the class M3u8Converter:
from m3u8toMP3 import M3u8Converter
...
async def main():
mp3_bytes = await M3u8Converter.convert_to_mp3(m3u8_bytes)
...
Metadata
Release files for m3u8toMP3 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| m3u8tomp3-0.1.1.tar.gz | 4.8 kB | Without provenance | Details for m3u8tomp3-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| m3u8tomp3-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for m3u8tomp3-0.1.1-py3-none-any.whl |
Total release size: 11.4 kB
Release files / m3u8tomp3-0.1.1.tar.gz
| Download URL | m3u8tomp3-0.1.1.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8fe048f3aba00c478b2c07b206a3292435da3a4cfcc7033502fc8208aa2d34b
|
|
BLAKE2b-256 checksum How to use checksums |
a8b33cfa3db825969ebee9c111cf351411bf0146e3292892964bddeb534a7eb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Release files / m3u8tomp3-0.1.1-py3-none-any.whl
| Download URL | m3u8tomp3-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c695e9c90fbee9edaca860848f6fd7ecda1858393d6c936e6d27e8643e1340d
|
|
BLAKE2b-256 checksum How to use checksums |
21d65777214fdf08f365164679d34b02f8fb91374caa49d9d098dd194c203ca4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.20
|
Security for m3u8toMP3 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.