This guide will help you set up Auto-M4B and convert your first audiobook in less than 10 minutes.
Before you begin, make sure you have:
- Docker installed (Install Docker)
- Docker Compose installed (Install Docker Compose)
- Basic familiarity with the command line
- An audiobook to test with (MP3 or M4A files)
Auto-M4B needs to know your user ID and group ID to set correct file permissions:
# On Linux/macOS, run:
id
# You'll see output like:
# uid=1000(yourname) gid=1000(yourname) groups=...
# Your PUID is 1000 and PGID is 1000Note: Pre-built Docker images are not currently available on Docker Hub. You'll need to build the image locally.
git clone https://github.com/DarthDobber/auto-m4b.git
cd auto-m4b# Create folders for audiobook processing
mkdir -p ~/audiobooks/{inbox,converted,archive,backup,failed}docker build -t darthdobber/auto-m4b:latest .This will take 5-10 minutes on the first build as it compiles ffmpeg and other dependencies.
Create a file called docker-compose.yml:
version: '3.7'
services:
auto-m4b:
image: darthdobber/auto-m4b:latest
container_name: auto-m4b
restart: unless-stopped
volumes:
- ~/audiobooks/inbox:/inbox
- ~/audiobooks/converted:/converted
- ~/audiobooks/archive:/archive
- ~/audiobooks/backup:/backup
- ~/audiobooks/failed:/failed
environment:
# Replace with your PUID/PGID from the 'id' command
- PUID=1000
- PGID=1000
# Folder paths (these match the volume mounts above)
- INBOX_FOLDER=/inbox
- CONVERTED_FOLDER=/converted
- ARCHIVE_FOLDER=/archive
- BACKUP_FOLDER=/backup
- FAILED_FOLDER=/failed
# Optional: performance tuning
- CPU_CORES=2
- SLEEP_TIME=10
# Optional: retry configuration (Phase 1.2)
- MAX_RETRIES=3
- RETRY_TRANSIENT_ERRORS=Y
- RETRY_BASE_DELAY=60Before starting the container, verify your configuration is correct:
docker-compose run --rm auto-m4b pipenv run python -m src --validateYou should see:
✓ Configuration is valid!
Configuration summary:
INBOX_FOLDER: /inbox
CONVERTED_FOLDER: /converted
...
If you see any errors, fix them in your docker-compose.yml before proceeding.
Tip: You can also view all available configuration options:
docker run --rm darthdobber/auto-m4b:latest pipenv run python -m src --help-config# Start Auto-M4B
docker-compose up -d
# Check if it's running
docker-compose ps
# View logs
docker-compose logs -f# Copy an audiobook folder to the inbox
cp -r /path/to/your/audiobook ~/audiobooks/inbox/
# Or download directly to inbox
# The folder should contain MP3/M4A filesAuto-M4B will automatically detect the new book and start processing it. Watch the logs to see progress:
docker-compose logs -f auto-m4bAfter processing completes (timing depends on book size and CPU):
- Converted M4B:
~/audiobooks/converted/ - Original Files:
~/audiobooks/archive/(if ON_COMPLETE=archive) - Backup Copy:
~/audiobooks/backup/(if BACKUP=Y)
If a book fails conversion after the maximum number of retries (default: 3), Auto-M4B will automatically:
- Move the book to the
failed/folder with a timestamp - Create a
FAILED_INFO.txtfile with:- Failure reason and error details
- Number of retry attempts made
- Recovery instructions
To retry a failed book:
# Fix the issues (if possible), then move it back to inbox
mv ~/audiobooks/failed/BookName_TIMESTAMP ~/audiobooks/inbox/BookNameAuto-M4B will detect that files changed and reset the retry counter, giving you fresh retry attempts.
Auto-M4B uses five main folders:
~/audiobooks/
├── inbox/ # Place new audiobooks here (input)
├── converted/ # Converted M4B files appear here (output)
├── archive/ # Original files moved here after conversion
├── backup/ # Backup of original files (optional)
└── failed/ # Books that failed after max retries
- inbox/: Add audiobooks here for processing. Auto-M4B watches this folder continuously.
- converted/: Your finished M4B audiobooks will be placed here, ready for tagging or importing to Plex/Audiobookshelf.
- archive/: Original files are moved here after successful conversion (configurable with
ON_COMPLETE). - backup/: A backup copy of originals before processing (can be disabled with
BACKUP=N). - failed/: Books that failed conversion after max retries are moved here with detailed failure information.
Let's verify everything works correctly.
- Create a test audiobook folder:
mkdir -p ~/audiobooks/inbox/test-book-
Add some MP3 files (or use your own audiobook)
-
Watch the logs:
docker-compose logs -fYou should see output like:
Starting auto-m4b...
Scanning inbox for new books...
Found: test-book
Converting to M4B...
Conversion complete!
Moving to converted/
- Check the output:
ls -la ~/audiobooks/converted/test-book/
# You should see: test-book.m4bIf you see permission errors:
-
Make sure your
PUIDandPGIDmatch your user:id # Check your UID/GID -
Update your
docker-compose.ymlwith correct values -
Restart the container:
docker-compose down docker-compose up -d
Check the logs for errors:
docker-compose logs auto-m4bCommon causes:
- Invalid folder paths in environment variables
- Folders don't exist (create them first)
- Port conflicts (if using Web UI in the future)
-
Check folder permissions:
ls -la ~/audiobooks/inbox/ -
Verify files are recognized audio formats:
- Supported:
.mp3,.m4a,.m4b,.ogg,.wma
- Supported:
-
Check logs for errors:
docker-compose logs -f
Here are the most useful settings for getting started:
| Variable | Default | Description |
|---|---|---|
PUID |
1000 | User ID for file ownership |
PGID |
1000 | Group ID for file ownership |
CPU_CORES |
All cores | Number of CPU cores to use |
SLEEP_TIME |
10 | Seconds between inbox scans |
BACKUP |
Y | Create backup of original files |
DEBUG |
N | Enable detailed logging |
MAX_RETRIES |
3 | Maximum retry attempts for failed books |
RETRY_TRANSIENT_ERRORS |
Y | Automatically retry transient errors |
RETRY_BASE_DELAY |
60 | Base delay (seconds) for exponential backoff |
MOVE_FAILED_BOOKS |
Y | Move failed books to failed folder |
For a complete list, see the Configuration Reference.
Check your conversion statistics at any time:
# View metrics
docker-compose exec auto-m4b pipenv run python -m src --statusThis shows:
- Lifetime and session statistics
- Success rates
- Recent conversions
- Recent failures with error details
Metrics are automatically displayed on container startup and persisted to /config/metrics.json (safe from accidental deletion when moving converted files).
Now that you have Auto-M4B running:
- Process your audiobook collection: Copy books to the inbox folder
- Monitor conversions: Check metrics with
--statusto track progress - Tune performance: Adjust
CPU_CORESbased on your system - Set up automation: Configure your download client to save directly to inbox
- Integrate with taggers: Use beets-audible to tag and organize converted books
- Import to media server: Add the
converted/folder to Plex, Audiobookshelf, etc.
Mount your NAS shares and point volumes to them:
volumes:
- /mnt/nas/audiobooks/inbox:/inbox
- /mnt/nas/audiobooks/converted:/convertedInstead of moving files, use this in your torrent client's "On Complete" script:
cp -r "%F" "/path/to/audiobooks/inbox"This copies files to inbox while leaving originals for seeding.
- Let Auto-M4B process the book normally
- Find the
.chapters.txtfile inconverted/bookname/ - Edit chapter names/times as needed
- Move the entire folder back to
inbox/ - Auto-M4B will re-chapterize using your edited file
- Documentation: docs/README.md
- Troubleshooting: docs/troubleshooting.md
- Configuration: docs/configuration.md
- GitHub Issues: Report a bug
Congratulations! You're now ready to start converting audiobooks with Auto-M4B. 🎉