Skip to content
m4b-audiobook-builder logo

M4B Audiobook Builder

m4b-audiobook-builder

Build and merge M4B audiobooks on Linux from multiple audio files or multi-part M4B sets, with chapter generation, metadata normalization, UTF-8/Russian encoding handling, and validation. Use when combining MP3/M4A/AAC/FLAC/OGG/WAV into one M4B, merging split M4B parts, or fixing audiobook chapte...

SKILL.md

Full skill instructions

M4B Audiobook Builder

Overview

Build a single player-friendly M4B from many audio parts or merge existing M4B parts while preserving metadata, normalizing text to UTF-8, and generating chapters. Keep details in references/​guide.md and use the helper script for repeatable inputs.

Workflow

  1. Confirm the scenario (mixed audio files vs existing M4B parts) and collect target metadata (title, author, performer/​narrator, cover art) from the source files metadata, folder names, and file names. Cover art may be embedded in the metadata of the source audio files or provided separately as file cover.jpg or same.
  2. Determine actual playback order; do not assume lexical filename order for multi-part M4B sets.
  3. Choose the best merge order, metadata source, and cover image source yourself using metadata and sidecar/​embedded art, then draft a single action plan that proposes those choices.
  4. Normalize filenames and tags to UTF-8, assuming Russian for any non-UTF-8 text.
  5. Show all the metadata and the order to the user and ask them to confirm the action plan (or adjust it) once before merging. Batch order, metadata, and cover questions into this one confirmation. After confirmation, do not ask follow-ups; proceed to merge/​recode and apply the confirmed metadata.
  6. Minimize model queries: batch related checks by combining multiple console commands and present consolidated outputs.
  7. Generate concat lists and chapters:
    • For mixed audio files, run the helper script to emit files.txt and meta.txt.
    • For existing M4B parts, generate only files.txt and follow the reference for chapter merging.
    • If per-file chapters are too fine-grained compared to the real book chapters, prefer per-directory chapters or a curated chapter list.
  8. Build the output M4B with ffmpeg:
    • Re-encode heterogeneous inputs.
    • If a source codec is exotic or poorly supported, re-encode to a well-supported codec (AAC for M4B is the default).
    • Use multi-threaded modes where supported (e.g., ffmpeg -threads) to speed up transcoding.
    • If the merge is long-running, set a sufficiently long command timeout in your runner up front (e.g., Codex CLI timeout_ms) to avoid re-runs.
    • If inputs may contain embedded cover art (common in MP3), map audio only (e.g., -map 0:a:0 -vn) to avoid accidental video streams.
    • Use -c copy only when M4B parts share compatible codecs.
  9. Apply audiobook metadata and cover art. Treat author and performer as distinct fields (author for albumArtist, performer/​narrator for artist) and format person names as Last First. If cover art found, embed it in the final M4B.
  10. Validate with mediainfo, mp4info, and a target player.

Helper Script

Run:

python3 scripts/​build_m4b_inputs.py --root . --recursive --chapter-mode dir --files-out files.txt --meta-out meta.txt --ffmpeg-out ffmpeg.sh --output-m4b book.m4b

Use this to create:

  • files.txt for ffmpeg concat input
  • meta.txt for ffmpeg chapter metadata
  • ffmpeg.sh with a ready-to-run ffmpeg command line (use --no-ffmpeg-out to skip)
  • atomicparsley.sh with a ready-to-run metadata command (use --no-atomicparsley-out to skip)

To generate a safe output filename like Author - Title.m4b, supply --output-author and --output-title (invalid filesystem characters are replaced). The script reorders author names to Last First by default when building the filename (use --name-order keep to preserve input). If omitted and --output-m4b is left at book.m4b, the script derives author/​title from the first input's tags and falls back to the folder name. If --output-m4b lacks the extension, .m4b is appended.

python3 scripts/​build_m4b_inputs.py --root . --chapter-mode file --files-out files.txt --meta-out meta.txt --output-author "Author" --output-title "Title"

Use --chapter-mode file for per-file chapters, or --chapter-mode none to generate only files.txt. For file chapters, the script prefers embedded track titles when present and falls back to filenames. Use --chapter-mode file only when file boundaries match real chapters; otherwise prefer dir or a curated chapter list.

For multi-part M4B sets, propose a merge order before any concat work:

python3 scripts/​propose_m4b_order.py --root . --files-out files.txt

Use the proposed order and metadata/​cover suggestions to build an action plan and ask the user to confirm before merging.

Extract and embed cover art (sidecar image or embedded metadata):

python3 scripts/​cover_art.py --root . --recursive --output cover.jpg --embed book.m4b

References

Use references/​guide.md for detailed commands, chapter formats, and scenario-specific procedures.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View