Skip to main content

A tool to standardize audiobook files into single m4b files with clean metadata based on Audible and chapters.

Project description

m4b-merge

Status GitHub Issues GitHub Pull Requests License PyPI PyPI - Python Version Python package CodeFactor Grade PyPI - Downloads


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.m4b format.
  • Moves finished files into done folder in input directory.

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 /input:/path/to/input -v /output:/path/to/output ghcr.io/djdembeck/m4b-merge:main

🔧 Running the tests

  • Run pip install pytest
  • To run all tests, run pytest from inside this project directory.
  • To run a single test, run pytest tests/test_NAME.py

🎈 Usage

Workflow

The process is simple

  1. Pass the file as input via -i FILE.ext or folder -i DIR/
  2. Enter the ASIN (found on audible.com) when prompted.
  3. 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

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

🎉 Acknowledgements

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

m4b-merge-0.4.5.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

m4b_merge-0.4.5-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file m4b-merge-0.4.5.tar.gz.

File metadata

  • Download URL: m4b-merge-0.4.5.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for m4b-merge-0.4.5.tar.gz
Algorithm Hash digest
SHA256 3e7b54ae54989bf814df10f051995d052b8e57784d4e3abe216d5a217a50e118
MD5 b49becf596dbfb94eccc243e6381ce55
BLAKE2b-256 d3fabd07e5681e23b9b2df6f2700f30ae7d0d28e996b6f9fe5ce0b840fb8354d

See more details on using hashes here.

File details

Details for the file m4b_merge-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: m4b_merge-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for m4b_merge-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 fd9f4d1fd747ce8e1f400298f6a553bcbd03391cc7bc0a575b575199ca442b2b
MD5 5849315e93421474a7241f39efd3b4a8
BLAKE2b-256 faaffdbeb7b17695e11cde804b0f98359d0f289deca2ba4505140d5b4aa19972

See more details on using hashes here.

Supported by

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