{"id":20694724,"url":"https://github.com/weak-head/m4b-maker","last_synced_at":"2025-09-27T07:30:46.757Z","repository":{"id":262827271,"uuid":"887530076","full_name":"weak-head/m4b-maker","owner":"weak-head","description":"A set of bash scripts to convert audio files into M4B audiobooks with chapter markers and customizable bitrate. ","archived":false,"fork":false,"pushed_at":"2024-12-31T18:44:21.000Z","size":63,"stargazers_count":33,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T19:30:26.201Z","etag":null,"topics":["audiobook","bash","m4b","m4b-book","m4b-tool","shell-script"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weak-head.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-12T21:31:37.000Z","updated_at":"2024-12-29T10:32:08.000Z","dependencies_parsed_at":"2024-11-14T14:30:32.651Z","dependency_job_id":"8c3125a6-3a3c-48ef-ac3d-4046ade4726d","html_url":"https://github.com/weak-head/m4b-maker","commit_stats":null,"previous_names":["weak-head/m4b-audiobook-creator","weak-head/m4b-maker"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weak-head%2Fm4b-maker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weak-head%2Fm4b-maker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weak-head%2Fm4b-maker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weak-head%2Fm4b-maker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weak-head","download_url":"https://codeload.github.com/weak-head/m4b-maker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234405983,"owners_count":18827533,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audiobook","bash","m4b","m4b-book","m4b-tool","shell-script"],"created_at":"2024-11-17T00:06:11.463Z","updated_at":"2025-09-27T07:30:46.751Z","avatar_url":"https://github.com/weak-head.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \n  # M4B Audiobook Maker \u003c!-- omit from toc --\u003e\n\n  A set of bash scripts to convert audio files into M4B audiobooks with chapter markers, customizable bitrate, book metadata and embedded cover art.\n\n  \u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/weak-head/m4b-maker/actions/workflows/lint.yaml\"\u003e\n      \u003cimg alt=\"lint\" \n           src=\"https://img.shields.io/github/actions/workflow/status/weak-head/m4b-maker/lint.yaml?label=lint\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/weak-head/m4b-maker/releases\"\u003e\n      \u003cimg alt=\"GitHub Release\"\n           src=\"https://img.shields.io/github/v/release/weak-head/m4b-maker?color=blue\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.gnu.org/software/bash/\"\u003e\n      \u003cimg alt=\"#!/bin/bash\" \n           src=\"https://img.shields.io/badge/-%23!%2Fbin%2Fbash-1f425f.svg?logo=image%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZV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hOuR1O1fQ2gT%2F26Z8Z5vrl2OHi9OXZn995nLV9aFfS6UC9JeJPfuK0NBohWpCHMSAAsFe74WWP%2BvT25wtP9Bpob6uGqqyDnOtaeumjRu%2ByFu36VntK%2FPA5umTJeUtPWZSU9BCgud661odVp3DZtkc7AnYR33RRC708PrVi1larW7XwZIjLnd7R6SgSqWSNjU1B3F72pz5TZbXmX5vV81Yb7Lg7XT%2FUXriu8XLVqw6c6XqWnBKiiYU%2BMt3wWF7u7i91XlSEITwSAZ%2FCzAAHsJVbwXYFFEAAAAASUVORK5CYII%3D\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/license/mit\"\u003e\n      \u003cimg alt=\"MIT License\" \n           src=\"https://img.shields.io/badge/license-MIT-blue\" /\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\n## Table of Contents \u003c!-- omit from toc --\u003e\n- [Overview](#overview)\n- [Getting Started](#getting-started)\n- [m4bify](#m4bify)\n- [m4bulk](#m4bulk)\n- [Usage Examples](#usage-examples)\n\n## Overview\n\nM4B Audiobook Maker is a set of bash scripts that simplify converting audio files into the M4B audiobook format. It includes `m4bify` for single conversions and `m4bulk` for batch processing.\n\n**Single Audiobook Conversion (`m4bify`)**\n\nCombines audio files into a single M4B audiobook with chapter markers, ensuring correct playback order by processing files alphabetically. Chapters are automatically created based on metadata, filenames, or top-level subdirectories. You can customize the audio quality, and if an image file or embedded art is available, it will be added as the book cover. Additionally, directory names that follow supported patterns are parsed to extract metadata such as the author, title, and year.\n\n**Batch Audiobook Conversion (`m4bulk`)**\n\nScan a root directory for audiobook folders and convert them to M4B files in parallel. Pass custom options, such as bitrate and chapter settings, to apply them to all audiobooks. `m4bulk` leverages multiple worker threads for simultaneous processing, speeding up batch conversions.\n\n## Getting Started\n\nEnsure the following dependencies are installed: [ffmpeg](https://ffmpeg.org) and [mp4v2](https://mp4v2.org/).\n\n```bash\n# For RPM-based systems (Fedora, RHEL, CentOS)\nsudo dnf install ffmpeg libmp4v2\n\n# For Debian-based systems (Ubuntu, Debian)\nsudo apt install ffmpeg\n```\n\nTo install the scripts, run:\n\n```bash\nmake install\n```\n\nThis installs the scripts to `/usr/local/sbin/`.\n\n## m4bify\n\n`m4bify` creates M4B audiobook by processing files in the specified directory, sorting them alphabetically to ensure the correct playback order. Chapters can be organized either as file-based, where each audio file becomes its own chapter named using metadata or filenames, or directory-based, where each top-level subdirectory is treated as a chapter, combining all its audio files, including those in nested folders, into one.\n\nOther features include:\n\n- Configurable audio bitrate, with high-quality AAC VBR as the default.\n- Metadata extraction from directory names that follow supported patterns.\n- Automatic cover art inclusion from image files or embedded artwork.\n- Embedding book descriptions from external text or Markdown files.\n- Comprehensive logs with chapter metadata.\n\n**Syntax**\n\n```bash\nm4bify [--help] [-d | --chapters-from-dirs] [-b \u003cbitrate\u003e | --bitrate \u003cbitrate\u003e] \u003cdirectory\u003e\n```\n\n**Options**\n\n- `-d`, `--chapters-from-dirs`: Treats each top-level subdirectory as a chapter.\n- `-b \u003cvalue\u003e`, `--bitrate \u003cvalue\u003e`: Sets the audio encoding bitrate (e.g. \"128k\", default: VBR Very High).\n- `--help`: Displays usage instructions and exits.\n\n**Arguments**\n\n- `\u003cdirectory\u003e` (required): Path to the directory containing audiobook files.\n\n**Directory Patterns**\n\n| Pattern | Example |\n|---|---|\n| `\u003cauthor_name\u003e - \u003cbook_title\u003e (\u003cyear\u003e)` | J.K. Rowling - Harry Potter and the Philosopher's Stone (1997) |\n| `\u003cauthor_name\u003e - \u003cbook_title\u003e` | Agatha Christie - Murder on the Orient Express |\n| `\u003cbook_title\u003e (\u003cyear\u003e)` | To Kill a Mockingbird (1960) |\n\nBoth hyphen (`-`) and underscore (`_`) are supported as separators. Additionally, square brackets (`[]`) can be used as an alternative to parentheses (`()`) for enclosing year information.\n\n## m4bulk\n\n`m4bulk` automates batch conversion of audiobook folders to M4B format using `m4bify`. It scans a root directory for audiobook folders and processes them in parallel.\n\nKey features:\n\n- Distributes tasks across multiple workers.\n- Automatically detects audiobook directories in the root folder.\n- Allows customization of `m4bify` options, such as bitrate and chapter generation.\n- Generates and saves logs for each audiobook conversion in the source folder.\n\n**Syntax**\n\n```bash\nm4bulk [--help] [--workers \u003cN\u003e] [m4bify-options] \u003caudiobooks_directory\u003e\n```\n\n**Options**\n\n- `--workers \u003cN\u003e`: Number of worker threads (default: 50% of CPU cores).\n- `--help`: Displays usage instructions and exits.\n\n**Arguments**\n\n- `[m4bify-options]` (optional): Optional arguments passed directly to `m4bify` (e.g. `-b \u003crate\u003e`).\n- `\u003caudiobooks_directory\u003e` (required): Directory containing subdirectories of audiobooks to convert.\n\n## Usage Examples\n\n**Metadata Extracted from Directory Name**\n\nCombine all audio files in `/home/user/audiobooks/Author Name - Book Title (1993)/` into a single M4B audiobook. Chapters are automatically generated based on file metadata or filenames. Author, title and year are extracted from the directory name:\n\n```bash\nm4bify \"/home/user/audiobooks/Author Name - Book Title (1993)\"\n```\n\n**Subdirectory Chapters with Custom Bitrate**\n\nCombine all top-level subdirectories in `/home/user/audiobooks/book/` into a single audiobook, with each subdirectory treated as a separate chapter. Files are processed recursively in alphabetical order, with audio encoded at 96 kbps:\n\n```bash\nm4bify --chapters-from-dirs --bitrate 96k /home/user/audiobooks/book\n```\n\n**Bulk Conversion with Default Settings**\n\nConvert all subdirectories in `/home/user/audiobooks/` to M4B format using default settings. The process utilizes 50% of available CPU cores:\n\n```bash\nm4bulk /home/user/audiobooks\n```\n\n**Bulk Conversion with Custom Threads and Bitrate**\n\nConvert audiobook directories in `/home/user/audiobooks/` with 4 worker threads. Each subdirectory is treated as a chapter, and audio is encoded at 128 kbps:\n\n```bash\nm4bulk --workers 4 -d -b 128k /home/user/audiobooks\n```\n\n## Contributing \u003c!-- omit from toc --\u003e\n\nContributions, bug reports, and feature requests are welcome! Feel free to open an issue or submit a pull request.\n\n## License \u003c!-- omit from toc --\u003e\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Acknowledgments \u003c!-- omit from toc --\u003e\n\nThanks to the creators of [ffmpeg](https://ffmpeg.org) and [mp4v2](https://mp4v2.org/) for their excellent tools that make this project possible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweak-head%2Fm4b-maker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweak-head%2Fm4b-maker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweak-head%2Fm4b-maker/lists"}