GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - birosrichard/audiobook-converter: Turn a folder of audio chapters into a single `.m4b` audiobook for Apple Books.

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
test
test
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package.json
package.json
 
 
pnpm-lock.yaml
pnpm-lock.yaml
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

Audiobook Converter

Turn a folder of audio chapters into a single .m4b audiobook for Apple Books.

The converter keeps chapters in the correct order, adds chapter markers and book details, and embeds a cover image when one is available. Your original audio files are never changed or deleted.

What it can do

  • Combine many chapter files into one M4B audiobook
  • Create chapter markers using the original filenames
  • Sort numbered files correctly (2 comes before 10)
  • Add a title, author, audiobook genre, and cover image
  • Show progress while the audiobook is being created
  • Work with AAC, AIFF (.aif and .aiff), FLAC, M4A, MKA, MP3, OGG, OPUS, WAV, and WMA files
  • Mix supported audio formats in the same folder
  • Preserve stereo audio
  • Refuse to overwrite an existing audiobook

Before you start

You need:

  • macOS
  • Node.js 18 or newer
  • FFmpeg

The easiest way to install everything is with Homebrew:

brew install node ffmpeg

Installation

Install the converter from npm:

npm install --global audiobook-converter

You can now use audiobook-convert from any folder in Terminal.

To check that it is installed:

audiobook-convert --version

Quick start

1. Prepare the audiobook folder

Put all chapter files directly inside one folder. Their filenames determine their order and chapter titles.

My Audiobook/
├── 01 - Introduction.opus
├── 02 - The First Day.opus
├── 03 - A New Discovery.mp3
└── cover.jpg

Numbered files are sorted naturally, so 1, 2, and 10 appear in that order. A leading number and separator are removed from the chapter title:

01 - Introduction.opus  →  Introduction
02. The First Day.mp3   →  The First Day
03_A New Discovery.wav  →  A New Discovery

2. Run the converter

Pass the folder to the command:

audiobook-convert "/Users/me/Downloads/My Audiobook"

Quotes are recommended when a path contains spaces.

3. Open the result

The finished M4B is created next to the input folder:

Downloads/
├── My Audiobook/
└── My Audiobook.m4b

Drag the .m4b file into Apple Books or use File → Import in the Books app.

Add book details

Use --title and --author to set the information shown in Apple Books:

audiobook-convert \
  "./Harry Potter 1" \
  --title "Harry Potter and the Philosopher's Stone" \
  --author "J. K. Rowling"

If no title is provided, the input folder name is used. If no author is provided, the audiobook uses Unknown Author.

Add a cover

When no cover is specified, the converter automatically looks inside the audiobook folder for these filenames:

cover.jpg
cover.jpeg
cover.png
folder.jpg
folder.png

You can choose another image with --cover:

audiobook-convert "./My Audiobook" --cover "./artwork.png"

JPG and PNG images are supported. The image is embedded inside the finished M4B, so the separate cover file is not needed afterward.

Choose the output file

Use --output or -o to choose where the audiobook is saved:

audiobook-convert \
  "./My Audiobook" \
  --output "/Users/me/Desktop/My Audiobook.m4b"

The .m4b extension is added automatically when omitted. Existing files are never replaced; choose a different output path or move the old file first.

Choose audio quality

The default AAC bitrate is 96k, which is a good balance for spoken audio. Use --bitrate if you prefer a different value:

audiobook-convert "./My Audiobook" --bitrate 128k

A higher bitrate can improve quality but creates a larger file.

Full example

audiobook-convert \
  "/Users/me/Downloads/Upgrade" \
  --title "Upgrade" \
  --author "Blake Crouch" \
  --cover "/Users/me/Downloads/Upgrade/cover.jpg" \
  --bitrate 128k \
  --output "/Users/me/Downloads/Blake Crouch - Upgrade.m4b"

Options

Option Purpose
--title "Book Title" Set the audiobook title
--author "Author Name" Set the author
--cover path/to/image.jpg Choose a JPG or PNG cover
--output path/to/book.m4b Choose the output file
-o path/to/book.m4b Short form of --output
--bitrate 128k Choose the AAC bitrate; default is 96k
--verbose or -v Show more details when diagnosing a problem
--help or -h Show command help
--version Show the installed version

Troubleshooting

ffmpeg or ffprobe is missing

Install FFmpeg and try again:

brew install ffmpeg

No supported audio files were found

Make sure the chapter files:

  • use one of the supported formats listed above
  • are directly inside the selected folder, not inside subfolders
  • have normal audio file extensions such as .opus, .mp3, or .m4a

The output file already exists

The converter will not overwrite an audiobook. Move or rename the existing file, or choose another path with --output.

An audio file or cover cannot be read

The file may be damaged or use an unsupported variation. Run the command again with --verbose to see which file caused the problem:

audiobook-convert "./My Audiobook" --verbose

Apple Books shows old information

Apple Books may remember details from an older import. Remove the old copy from Books, then import the new M4B again.

Uninstall

npm uninstall --global audiobook-converter

Development

To work on the project locally, clone the repository and install its dependencies with pnpm:

git clone https://github.com/birosrichard/audiobook-converter.git
cd audiobook-converter
pnpm install
pnpm test
pnpm link --global

License

MIT

About

Turn a folder of audio chapters into a single `.m4b` audiobook for Apple Books.

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.