This guide provides practical examples of common workflows for using Auto-M4B in different scenarios.
- Basic Single Book Conversion
- Batch Processing Multiple Books
- Automated Download Integration
- Manual Chapter Editing Workflow
- Handling Failed Books
- Torrent Seeding Preservation
- NAS/Network Storage Setup
- Testing New Books Before Bulk Processing
Goal: Convert one audiobook from MP3/M4A to M4B format.
-
Prepare your audiobook folder:
MyAudiobook/ ├── 01 - Chapter One.mp3 ├── 02 - Chapter Two.mp3 ├── 03 - Chapter Three.mp3 └── cover.jpg -
Copy to inbox:
cp -r /path/to/MyAudiobook ~/audiobooks/inbox/ -
Watch the logs:
docker-compose logs -f auto-m4b
-
Get your converted M4B:
# After conversion completes ls ~/audiobooks/converted/MyAudiobook/ # You'll find: MyAudiobook.m4b
-
Originals are archived:
ls ~/audiobooks/archive/MyAudiobook/ # Original files preserved here
Starting auto-m4b...
Scanning inbox for new books...
Found: MyAudiobook
Converting to M4B...
Progress: Converting audio files...
Progress: Creating chapters...
Progress: Embedding metadata...
Conversion complete!
Moving to converted/
Archiving originals...
Done! MyAudiobook.m4b ready.
Goal: Convert 10+ audiobooks overnight.
-
Prepare multiple books:
# Copy all books at once cp -r /path/to/audiobooks/* ~/audiobooks/inbox/
-
Monitor progress:
# Watch logs in real-time docker-compose logs -f auto-m4b # Or check how many are left ls ~/audiobooks/inbox/ | wc -l
-
Check results in the morning:
# Converted books ls ~/audiobooks/converted/ # Any failures ls ~/audiobooks/failed/
For faster batch processing, adjust CPU cores:
environment:
- CPU_CORES=8 # Use more cores for faster conversion
- SLEEP_TIME=5 # Check inbox more frequently# Start batch before bed
cp -r /media/downloads/audiobooks/* ~/audiobooks/inbox/
# Check progress in morning
docker-compose logs --tail=50 auto-m4bGoal: Automatically convert books as they're downloaded.
Configure "On Download Complete" script:
Script: /path/to/auto-m4b-copy.sh
#!/bin/bash
# Copy completed audiobook to Auto-M4B inbox
SOURCE="$1" # Torrent path
INBOX="/path/to/audiobooks/inbox"
# Copy (not move) to preserve seeding
cp -r "$SOURCE" "$INBOX/"
echo "Copied $SOURCE to Auto-M4B inbox"qBittorrent Settings:
- Tools → Options → Downloads
- "Run external program on torrent completion"
- Command:
/path/to/auto-m4b-copy.sh "%F"
SABnzbd:
- Config → Categories → audiobooks
- Script:
auto-m4b-copy.sh
NZBGet:
- Settings → Categories → audiobooks
- PostScript:
auto-m4b-copy.sh
Syncthing / Dropbox / Google Drive:
volumes:
- ~/Dropbox/AudiobooksToConvert:/inbox
- ~/audiobooks/converted:/convertedDrop files in Dropbox folder → Auto-M4B converts → Converted files appear in output.
Goal: Fix incorrect chapter names or adjust chapter timing.
-
Let Auto-M4B do initial conversion:
cp -r MyBook ~/audiobooks/inbox/ # Wait for conversion to complete
-
Find the chapters file:
cd ~/audiobooks/converted/MyBook/ ls -la # Look for: MyBook.chapters.txt
-
Edit chapter names:
nano MyBook.chapters.txt
Before:
CHAPTER01=00:00:00.000 CHAPTER01NAME=01 - Track One CHAPTER02=00:15:30.000 CHAPTER02NAME=02 - Track TwoAfter:
CHAPTER01=00:00:00.000 CHAPTER01NAME=Prologue: The Beginning CHAPTER02=00:15:30.000 CHAPTER02NAME=Chapter One: The Journey Starts -
Re-process with edited chapters:
# Move entire folder back to inbox mv ~/audiobooks/converted/MyBook ~/audiobooks/inbox/ # Auto-M4B detects the .chapters.txt file and uses it
-
Get re-chapterized M4B:
# New version appears in converted/ ls ~/audiobooks/converted/MyBook/MyBook.m4b
- Auto-M4B prioritizes existing
.chapters.txtfiles - You can manually create a
.chapters.txtfile before first conversion - Chapter times are in format:
HH:MM:SS.mmm
Goal: Troubleshoot and retry failed conversions.
Auto-M4B will retry transient errors automatically (default: 3 attempts with exponential backoff).
Check the logs:
docker-compose logs auto-m4b | grep -A 10 "ERROR"If max retries exceeded, the book moves to failed/ folder:
ls ~/audiobooks/failed/
# Output: MyBook_2025-10-13_14-23-45/cat ~/audiobooks/failed/MyBook_*/FAILED_INFO.txtExample:
FAILED BOOK INFORMATION
============================================================
Book Name: MyBook
Failed At: 14:23:45
Error Type: Transient
Retry Count: 3
Max Retries: 3
Failure Reason:
------------------------------------------------------------
m4b-tool failed to convert MyBook, no output .m4b file was found
------------------------------------------------------------
RECOVERY INSTRUCTIONS:
1. Fix the issue with the audiobook files in this directory
2. Move the fixed folder back to: /temp/inbox
3. auto-m4b will detect it as a previously failed book and retry
Symptoms: "Invalid data found when processing input"
Fix:
# Find corrupted file
cd ~/audiobooks/failed/MyBook_*/
for f in *.mp3; do
ffmpeg -v error -i "$f" -f null - 2>&1 && echo "$f: OK" || echo "$f: CORRUPTED"
done
# Re-download or replace corrupted file
# Then retry
mv ~/audiobooks/failed/MyBook_*/ ~/audiobooks/inbox/MyBookSymptoms: "Could not find cover art"
Fix:
# Add a cover.jpg to the folder
cd ~/audiobooks/failed/MyBook_*/
curl -o cover.jpg "https://example.com/book-cover.jpg"
# Retry
mv ~/audiobooks/failed/MyBook_*/ ~/audiobooks/inbox/MyBookSymptoms: "No space left on device"
Fix:
# Free up space
df -h ~/audiobooks/
# Clean up archives if needed
rm -rf ~/audiobooks/archive/*
# Or disable backup
docker-compose down
# Edit docker-compose.yml: BACKUP=N
docker-compose up -d
# Retry
mv ~/audiobooks/failed/MyBook_*/ ~/audiobooks/inbox/MyBookAdjust retry behavior:
environment:
- MAX_RETRIES=5 # Try 5 times instead of 3
- RETRY_TRANSIENT_ERRORS=Y # Auto-retry transient errors
- RETRY_BASE_DELAY=120 # Wait 2 minutes between retries (doubles each time)
- MOVE_FAILED_BOOKS=Y # Move to failed folder after max retriesGoal: Convert audiobooks while continuing to seed the original torrent.
Moving files from torrent client to Auto-M4B breaks seeding.
qBittorrent "Run on completion" script:
#!/bin/bash
# auto-m4b-copy-for-seeding.sh
TORRENT_PATH="$1"
INBOX="/path/to/audiobooks/inbox"
# Copy (don't move) to preserve seeding
cp -r "$TORRENT_PATH" "$INBOX/"
echo "Copied to Auto-M4B: $(basename "$TORRENT_PATH")"Usage:
- Tools → Options → Downloads → "Run external program"
- Command:
/path/to/auto-m4b-copy-for-seeding.sh "%F"
volumes:
# Torrent downloads stay here
- ~/torrents/complete:/watch:ro # Read-only!
# Auto-M4B copies to inbox
- ~/audiobooks/inbox:/inbox
- ~/audiobooks/converted:/convertedSync script (run via cron):
#!/bin/bash
# sync-torrents-to-inbox.sh
TORRENT_DIR="~/torrents/complete/audiobooks"
INBOX_DIR="~/audiobooks/inbox"
# Copy new books (rsync preserves originals)
rsync -av --ignore-existing "$TORRENT_DIR/" "$INBOX_DIR/"Cron (every 10 minutes):
crontab -e
# Add:
*/10 * * * * /path/to/sync-torrents-to-inbox.shGoal: Run Auto-M4B on NAS (Synology, QNAP, TrueNAS) or use network storage.
-
Install Docker (Package Center → Docker)
-
Create folder structure:
/volume1/audiobooks/ ├── inbox/ ├── converted/ ├── archive/ ├── backup/ └── failed/ -
Create docker-compose.yml via File Station
-
Find PUID/PGID:
# SSH into Synology ssh admin@synology-ip id username -
Deploy:
- Docker app → Container → Create
- Import docker-compose.yml
- Start container
Mount network share first:
# Mount SMB share
sudo mount -t cifs //nas-ip/audiobooks /mnt/nas-audiobooks -o username=user,password=pass
# Or NFS
sudo mount -t nfs nas-ip:/audiobooks /mnt/nas-audiobooksdocker-compose.yml:
volumes:
- /mnt/nas-audiobooks/inbox:/inbox
- /mnt/nas-audiobooks/converted:/converted
- /mnt/nas-audiobooks/archive:/archive
- /mnt/nas-audiobooks/backup:/backup
- /mnt/nas-audiobooks/failed:/failed- Use local working folder for better performance:
environment: - WORKING_FOLDER=/tmp/auto-m4b # Local SSD volumes: - /fast-local-disk/auto-m4b-temp:/tmp/auto-m4b
Goal: Test Auto-M4B with one book before processing 100+ books.
-
Pick a representative book:
- Medium length (5-10 hours)
- Typical format (MP3 or M4A)
- Has cover art
-
Enable debug mode:
environment: - DEBUG=Y
-
Process test book:
cp -r /path/to/TestBook ~/audiobooks/inbox/ docker-compose logs -f auto-m4b -
Verify output:
# Check M4B file ls -lh ~/audiobooks/converted/TestBook/TestBook.m4b # Play in VLC or audiobook app # Verify chapters work correctly # Check metadata (title, author, cover)
-
If successful, process full library:
docker-compose down # Edit docker-compose.yml: DEBUG=N docker-compose up -d # Process all books cp -r /library/audiobooks/* ~/audiobooks/inbox/
- M4B file created successfully
- Chapters are correct and named properly
- Cover art embedded
- Metadata preserved (title, author, year)
- File size is reasonable (similar to originals)
- Playback works in your audiobook app
Goal: Auto-convert → Auto-tag → Auto-organize
# 1. Auto-M4B converts to M4B
/audiobooks/inbox → /audiobooks/converted
# 2. Beets-Audible tags and organizes
beet import /audiobooks/converted
# 3. Organized audiobooks
/media/audiobooks/Author/Title/Title.m4bSetup:
# docker-compose.yml
services:
auto-m4b:
volumes:
- ./inbox:/inbox
- ./converted:/converted
- ../beets-import:/converted # Same folder as beets import
beets:
volumes:
- ../beets-import:/import
- /media/audiobooks:/musicGoal: Converted books automatically appear in media server.
# docker-compose.yml
volumes:
# Auto-M4B outputs directly to Plex/Audiobookshelf library
- /plex/audiobooks:/converted
environment:
- ON_COMPLETE=archive # Keep originals in archivePlex setup:
- Add library:
/plex/audiobooks - Type: Music (for audiobooks)
- Scan automatically: Enabled
Check:
# Is Auto-M4B running?
docker-compose ps
# Are files in correct location?
ls ~/audiobooks/inbox/
# Check logs for errors
docker-compose logs auto-m4bSolutions:
- Increase CPU cores:
CPU_CORES=8 - Use faster storage for WORKING_FOLDER
- Process books one at a time instead of batch
Fix:
# Find your user ID
id
# Update docker-compose.yml
environment:
- PUID=1000 # Use your UID
- PGID=1000 # Use your GID
# Restart
docker-compose restart- Configuration Reference - Tune settings for your workflow
- Troubleshooting Guide - Fix common issues
- Architecture Overview - Understand how it works
Questions? Open an issue or start a discussion.