m4b-merge
A CLI tool which outputs consistently sorted, tagged, single m4b files regardless of the input.
📝 Table of Contents
🧐 About
m4b-merge was originally part of Bragi Books, but was split apart to allow savvy users to automate its usage in more advanced ways. Some of the things m4b-merge offers are:
- Accepts single and multiple mp3, m4a and m4b files.
- mp3s are converted to m4b. m4a/m4b files are edited/merged without conversion.
- Matches existing bitrate and samplerate for target file conversions.
- Final files moved to
/output/Author/Book/Book: Subtitle.m4bformat. - Moves finished files into
donefolder ininputdirectory.
Metadata provided by audnexus:
- Title, authors, narrators, description, series, genres, release year - written as tags.
- Chapter times/titles (only when input is m4b or a single mp3) - written as tags and
chapters.txt. - High resolution (2000x2000 or greater) cover art - embedded into output file.
🏁 Getting Started
Prerequisites
You can either install this project via pip directly or run it prepackaged in Docker:
- If installing directly on your system, you'll need to install m4b-tool and it's dependants from the project's readme
- If using Docker, all prerequisites are included in the image.
Installing
For a pip installation
Simply run
pip install m4b-merge
For a Docker installation
You'll need to specify input/output volumes in the run command for easy use later:
docker run --name=merge -v /path/to/input:/input -v /path/to/output:/output ghcr.io/djdembeck/m4b-merge:main
You may also specify the user and group to run as with env variables:
-e UID=99 -e GID=100
🔧 Running the tests
- Run
pip install pytest - To run all tests, run
pytestfrom inside this project directory. - To run a single test, run
pytest tests/test_NAME.py
🎈 Usage
Workflow
The process is simple
- Pass the file as input via
-i FILE.extor folder-i DIR/ - Enter the ASIN (found on audible.com) when prompted.
- Depending on necessary conversions, the process will take between 5 seconds and 5-10 minutes.
CLI usage
usage: m4b-merge [-h] [--api_url API_URL] [--completed_directory COMPLETED_DIRECTORY] -i INPUTS [INPUTS ...] [--log_level LOG_LEVEL]
[--num_cpus NUM_CPUS] [-o OUTPUT]
m4bmerge cli
optional arguments:
-h, --help show this help message and exit
--api_url API_URL Audnexus mirror to use
--completed_directory COMPLETED_DIRECTORY
Directory path to move original input files to
-i INPUTS [INPUTS ...], --inputs INPUTS [INPUTS ...]
Input paths to process
--log_level LOG_LEVEL
Set logging level
--num_cpus NUM_CPUS Number of CPUs to use
-o OUTPUT, --output OUTPUT
Output directory
-p PATH_FORMAT, --path_format PATH_FORMAT
Structure of output path/naming.Supported terms: author, narrator, series_name, series_position, subtitle, title, year
When installed via pip, you can run inputs like so
m4b-merge -i /path/to/file.mp3
Or for multiple inputs
m4b-merge -i /path/to/file.mp3 /dir/ /path/to/other/file
On Docker, you can run inputs like so
docker run -it merge m4b-merge -i /input/file.mp3
For a folder of multiple audio files, simply pass the folder itself as an input, such as -i /input/dir
⛏️ Built Using
✍️ Authors
- @djdembeck - Idea & Initial work
🎉 Acknowledgements
Metadata
Release files for m4b-merge 0.5.3
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 | |
|---|---|---|---|---|
| m4b_merge-0.5.3.tar.gz | 29.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| m4b_merge-0.5.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.3 kB
Release files / m4b_merge-0.5.3.tar.gz
| Download URL | m4b_merge-0.5.3.tar.gz |
|---|---|
| Size | 29.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e3c46aa33372dbeb434d09af45d88a65920969750b76272780e1a455247ba67b
|
|
BLAKE2b-256 checksum How to use checksums |
4339835bad904dd9d16bb1d68e2de645f96bfe2901d38d1dc4b4a49c69b57fcf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Release files / m4b_merge-0.5.3-py3-none-any.whl
| Download URL | m4b_merge-0.5.3-py3-none-any.whl |
|---|---|
| Size | 25.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
870f064e437398c92c8fb3e75bd6b964418f115ddc65e24f761ce3471a0d9026
|
|
BLAKE2b-256 checksum How to use checksums |
1fb89d24fa2a29e452dcdd27f925bba63a8d37310c4c36007094084aae533366
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.4
|
Security for m4b-merge 0.5.3
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.