MP3 to M4B Audiobook Converter - Convert MP3 files to M4B format with chapter support
Project description
BPM4B - Professional Multimedia Suite (v9.0.0)
A professional multimedia processing suite for converting MP3 to M4B, M4B to MP3, and generating AI Audiobooks with high-fidelity TTS and automatic chapter support.
Available in two versions:
- Python (Flask):
pip install bpm4bthenbpm4b - Node.js (Express):
npm install -g bpm4bthenbpm4b
Installation
Python Version (Original)
pip install bpm4b
bpm4b web
Node.js Version
npm install -g bpm4b
bpm4b web
Or for local development:
git clone https://github.com/jdjchelp-jpg/nodebpm4b.git
cd nodebpm4b
npm install
npm start
Update:
# Update Python version
pip install --upgrade bpm4b
# Update Node.js version
npm update -g bpm4b
Features
๐ฏ Unified Smart Mode
- Single toggle switch: Conversion Mode vs Chapter Builder Only
- Automatic chapter attachment to MKV/M4B output when conversion mode is ON
- Standalone timestamp generator when mode is OFF
๐ File Conversion Section
- MP3 to M4B: Convert MP3 files to audiobook format with embedded chapters
- M4B to MP3: High-fidelity conversion from M4B/M4A containers to MP3 (NEW in v9)
- Document to Audiobook: Generate high-quality voiceovers from PDF/Text using Kokoro-82M AI (NEW in v9)
- Drag-and-drop file upload for all tools
- Real-time progress monitoring with SSE (Server-Sent Events)
- Visual progress bar and live terminal logging
โฑ Automatic Chapter Builder
- Always enabled - core functionality
- Enter chapter title and duration (minutes or seconds toggle)
- System automatically:
- Converts input to proper format
- Accumulates duration to cumulative total
- Calculates next chapter start timestamp
- Generates proper HH:MM:SS format
- No manual math required - all timestamps auto-generate
- Batch import/export chapter lists
- Real-time preview updates
โ Settings Panel
- Dark / Light mode toggle
- Modern toggle switches (not checkboxes)
- Glassmorphism card design
- Smooth animations and transitions
- Responsive layout optimized for desktop
๐ Performance Improvements
- Faster parsing with optimized algorithms
- Non-blocking UI with background conversion
- Proper error handling and validation
- File size validation before processing
- Automatic cleanup of temporary files
๐ Professional Features
- Copy-to-clipboard buttons for generated commands
- Real-time updating preview panel
- FFmpeg command preview (self-service mode)
- Export chapters to .txt format
- Modern, clean, professional SaaS-like interface
Prerequisites
Node.js Version
No additional prerequisites needed! FFmpeg is bundled with the Node.js version, so it works out of the box.
Python Version (Original)
- Python 3.8+
- FFmpeg (required for MP3 to M4B conversion)
Installing FFmpeg (Python Version Only)
Windows:
- Go to https://www.gyan.dev/ffmpeg/builds/ (recommended Windows builds)
- Download "ffmpeg-git-full.7z" or "ffmpeg-release-full.7z"
- Extract the archive using 7-Zip or similar
- Open the extracted folder, navigate to the
binfolder - Copy the path to the
binfolder (contains ffmpeg.exe) - Add to PATH:
- Press Win + X, select "System"
- Click "Advanced system settings"
- Click "Environment Variables"
- Under "System variables", find and select "Path", click "Edit"
- Click "New" and paste the path to the
binfolder - Click OK on all windows
- Open a new command prompt and verify:
ffmpeg -version
macOS:
brew install ffmpeg
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install ffmpeg
Note: The Python version requires FFmpeg. The Node.js version includes FFmpeg automatically.
Usage
Web Interface
Start the web server and open your browser to http://localhost:5000:
# Start the server
bpm4b web
# Or with custom options
bpm4b web --port 8080
bpm4b web --host 127.0.0.1 --debug
The web interface allows you to:
- Upload MP3 files through a simple form
- Add custom chapter markers with titles and timestamps
- Download the converted M4B audiobook
Command Line (No Web Interface)
Convert MP3 to M4B directly from the terminal:
# Basic conversion
bpm4b convert input.mp3 output.m4b
# With chapter markers
bpm4b convert input.mp3 output.m4b --chapter "Introduction" 0
bpm4b convert input.mp3 output.m4b --chapter "Chapter 1" 3600 --chapter "Chapter 2" 7200
# Multiple chapters
bpm4b convert book.mp3 book.m4b \\
--chapter "Prologue" 0 \\
--chapter "Chapter 1" 300 \\
--chapter "Chapter 2" 1800
# Multiple chapters with MM:SS format
bpm4b convert book.mp3 book.m4b \\
--chapter "Prologue" "0:00" \\
--chapter "Chapter 1" "5:00" \\
--chapter "Chapter 2" "30:00"
# Mixed formats (seconds and MM:SS)
bpm4b convert book.mp3 book.m4b \\
--chapter "Intro" 0 \\
--chapter "Chapter 1" "6:30" \\
--chapter "Chapter 2" 3600
Chapter start times accept:
- Seconds as integer (e.g.,
390) - Minutes:seconds format (e.g.,
"6:30"or"6:30.5"for fractional seconds)
Using Python Module
Alternatively, you can run it as a Python module:
python -m bpm4b.cli web --port 5000
python -m bpm4b.cli convert input.mp3 output.m4b
Using the CLI (Package Installation)
After installing with pip install -e ., use the bpm4b command:
# Start web interface
bpm4b web
# Web interface with options
bpm4b web --port 8080
bpm4b web --host 127.0.0.1 --debug
# Convert MP3 to M4B directly
bpm4b convert input.mp3 output.m4b
bpm4b convert input.mp3 output.m4b --chapter "Chapter 1" 0
# Show help
bpm4b --help
bpm4b web --help
bpm4b convert --help
Using Python Module
Alternatively, you can run it as a Python module:
python -m bpm4b.cli web --port 5000
python -m bpm4b.cli convert input.mp3 output.m4b
Using the Traditional Method
If you installed dependencies only (without the package):
python app.py
Then open your browser and navigate to:
http://localhost:5000
Using the Tool
Once the server is running:
MP3 to M4B: Upload an MP3 file, add chapters using the automatic chapter builder, and click "Convert to M4B"
- Automatically converts to M4B format (iTunes/Apple Books compatible)
- Chapters automatically embedded with titles and timestamps
- Uses FFmpeg for high-quality AAC audio (64kbps - 256kbps)
M4B to MP3: Upload an M4B/M4A file and convert it to a standard MP3
- High-fidelity conversion using the libmp3lame encoder
- Perfect for playback on legacy devices or sharing
Audiobook Gen: Upload a PDF or Text document to generate a full audiobook
- Powered by Kokoro-82M Local TTS engine
- High-quality, human-like voice synthesis
- Automatic chapter detection and manifest generation
API Endpoints
POST /api/mp3-to-m4b
Converts an MP3 file to M4B with optional chapters.
Form Data:
mp3_file: The MP3 file to convertchapters(optional): JSON array of chapter objects.start_timeaccepts seconds (number) or MM:SS format (string):
[
{"title": "Chapter 1", "start_time": 0},
{"title": "Chapter 2", "start_time": "6:30"},
{"title": "Chapter 3", "start_time": 3600}
]
POST /api/convert
Converts MP3 to M4B or M4B to MP3.
Form Data:
source_file: The file to convertoutput_name: Custom filenameaudio_quality: Bitrate (e.g., '128k', '256k')chapters(optional): JSON array of chapter objects.
POST /api/generate-audiobook
Generates an audiobook from a document.
Form Data:
doc_file: The PDF or Text filevoice: Selection from available Kokoro voicesoutput_name: Custom filename
GET /api/health
Health check endpoint. Returns JSON with status and FFmpeg availability.
Response: Returns an M4B file as a download.
Project Structure
Python Version
.
โโโ bpm4b/ # Main package directory
โ โโโ __init__.py # Package initialization
โ โโโ app.py # Flask application (for local development)
โ โโโ cli.py # Command-line interface entry point
โ โโโ core.py # Shared core functions
โ โโโ api/
โ โ โโโ __init__.py
โ โ โโโ index.py # Vercel serverless function
โ โโโ templates/
โ โโโ index.html # Frontend interface
โโโ setup.py # Package installation configuration
โโโ vercel.json # Vercel configuration
โโโ requirements.txt # Python dependencies
โโโ uploads/ # Temporary uploaded files (created automatically)
โโโ outputs/ # Generated files (created automatically)
โโโ README.md # This file
Node.js Version
.
โโโ bin/
โ โโโ bpm4b.js # CLI entry point
โโโ lib/
โ โโโ core.js # Core conversion functions
โ โโโ server.js # Express web server
โโโ templates/
โ โโโ index.ejs # Frontend template
โโโ api/
โ โโโ index.js # Vercel serverless function
โโโ examples/ # Usage examples
โโโ test/ # Unit tests
โโโ package.json # NPM package configuration
โโโ vercel.json # Vercel configuration
โโโ uploads/ # Temporary uploaded files (created automatically)
โโโ outputs/ # Generated files (created automatically)
โโโ README_NODE.md # Node.js specific documentation
Notes
- Maximum file size for uploads: 2GB
- SSE (Server-Sent Events) used for real-time progress updates
- Kokoro AI engine runs locally (no API keys or external costs)
- M4B output files can be large (typically 0.96-2GB per hour of audio depending on bitrate)
- Optimized for high-speed conversion on Windows/macOS/Linuxion:
- X (Twitter): @jdjchelp
License
MIT
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bpm4b-9.0.2.tar.gz.
File metadata
- Download URL: bpm4b-9.0.2.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ded88606202a1a0578b72e4dd9309e0d5dfe70972f54fba90401dac4e3e7041
|
|
| MD5 |
20df93059b4a586ca3d62bd32fd43383
|
|
| BLAKE2b-256 |
8916f2daadff87f8c544612602712fa962f4d0df53cedcc71421abbea3cfbe0a
|
Provenance
The following attestation bundles were made for bpm4b-9.0.2.tar.gz:
Publisher:
publish.yml on jdjchelp-jpg/bpm4b
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bpm4b-9.0.2.tar.gz -
Subject digest:
8ded88606202a1a0578b72e4dd9309e0d5dfe70972f54fba90401dac4e3e7041 - Sigstore transparency entry: 1108431625
- Sigstore integration time:
-
Permalink:
jdjchelp-jpg/bpm4b@55b1bdb0e7edc892c2ac9bf605b4584e3ce6913f -
Branch / Tag:
refs/tags/v9.0.2 - Owner: https://github.com/jdjchelp-jpg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55b1bdb0e7edc892c2ac9bf605b4584e3ce6913f -
Trigger Event:
push
-
Statement type:
File details
Details for the file bpm4b-9.0.2-py3-none-any.whl.
File metadata
- Download URL: bpm4b-9.0.2-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd84fb1f6a0bf477f419ef1ef86ab6d558059ee0b6e45e769d4f133b2c04af8d
|
|
| MD5 |
e0849377d05a775f6c5f5a9d0f7ef077
|
|
| BLAKE2b-256 |
53106af024241412c9961f92ece78eb246e28068addce9873bc3abcc59998750
|
Provenance
The following attestation bundles were made for bpm4b-9.0.2-py3-none-any.whl:
Publisher:
publish.yml on jdjchelp-jpg/bpm4b
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bpm4b-9.0.2-py3-none-any.whl -
Subject digest:
fd84fb1f6a0bf477f419ef1ef86ab6d558059ee0b6e45e769d4f133b2c04af8d - Sigstore transparency entry: 1108431626
- Sigstore integration time:
-
Permalink:
jdjchelp-jpg/bpm4b@55b1bdb0e7edc892c2ac9bf605b4584e3ce6913f -
Branch / Tag:
refs/tags/v9.0.2 - Owner: https://github.com/jdjchelp-jpg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@55b1bdb0e7edc892c2ac9bf605b4584e3ce6913f -
Trigger Event:
push
-
Statement type: