Convert your m3u8 files to MP3
Project description
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)
...
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 Distribution
Built Distribution
File details
Details for the file m3u8tomp3-0.1.1.tar.gz
.
File metadata
- Download URL: m3u8tomp3-0.1.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8fe048f3aba00c478b2c07b206a3292435da3a4cfcc7033502fc8208aa2d34b |
|
MD5 | a1b295b76cb369d7ada61451fd80f401 |
|
BLAKE2b-256 | a8b33cfa3db825969ebee9c111cf351411bf0146e3292892964bddeb534a7eb3 |
File details
Details for the file m3u8tomp3-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: m3u8tomp3-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c695e9c90fbee9edaca860848f6fd7ecda1858393d6c936e6d27e8643e1340d |
|
MD5 | c448e7aab5ac0551e1253a6ee392a6ce |
|
BLAKE2b-256 | 21d65777214fdf08f365164679d34b02f8fb91374caa49d9d098dd194c203ca4 |