{"id":20914938,"url":"https://github.com/seanap/auto-m4b","last_synced_at":"2025-04-05T20:06:23.272Z","repository":{"id":37198929,"uuid":"476021230","full_name":"seanap/auto-m4b","owner":"seanap","description":"Docker container that watches a folder for multi-file mp3 books and converts them to a chapterized m4b.","archived":false,"fork":false,"pushed_at":"2024-07-04T14:35:27.000Z","size":39,"stargazers_count":305,"open_issues_count":29,"forks_count":40,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-29T19:06:51.780Z","etag":null,"topics":["audio-converter","audiobooks","docker","m4b"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/seanap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-03-30T19:21:18.000Z","updated_at":"2025-03-28T23:53:41.000Z","dependencies_parsed_at":"2024-02-11T16:31:14.488Z","dependency_job_id":"949cb655-2178-4d19-a239-e74e48902149","html_url":"https://github.com/seanap/auto-m4b","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanap%2Fauto-m4b","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanap%2Fauto-m4b/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanap%2Fauto-m4b/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seanap%2Fauto-m4b/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seanap","download_url":"https://codeload.github.com/seanap/auto-m4b/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393569,"owners_count":20931812,"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":["audio-converter","audiobooks","docker","m4b"],"created_at":"2024-11-18T16:12:14.343Z","updated_at":"2025-04-05T20:06:23.250Z","avatar_url":"https://github.com/seanap.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Auto-M4B\n\n[![Join the chat at https://gitter.im/Audiobook-Server/auto-m4b](https://badges.gitter.im/Audiobook-Server/auto-m4b.svg)](https://gitter.im/Audiobook-Server/auto-m4b?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nThis container is mostly based on the powerful [m4b-tool](https://github.com/sandreas/m4b-tool) made by sandreas  \nThis repo is my fork of the fantastic [docker-m4b-tool](https://github.com/9Mad-Max5/docker-m4b-tool) created by 9Mad-Max5. \n\nThis is a docker container that will watch a folder for new books, auto convert mp3 books to chapterized m4b, and move all m4b books to a specific output folder, this output folder is where the [beets.io audible plugin](https://github.com/seanap/beets-audible) will look for audiobooks and use the audible api to perfectly tag and organize your books.\n\n## Intended Use\nThis is meant to be an automated step between aquisition and tagging.\n* Install via docker-compose \n* Save new audiobooks to a /recentlyadded folder.\n* All multifile m4b/mp3/m4a/ogg books will be converted to a chapterized m4b and saved to an /untagged folder  \n* This script will watch `/temp/recentlyadded` and automatically move mp3 books to `/temp/merge`, then automatically put all m4b's in the output folder `/temp/untagged`.  It also makes a backup incase something goes wrong (can be disabled if desired).\n\nUse the [beets.io audible plugin](https://github.com/seanap/beets-audible) to finish the tagging and sorting.\n\n## Known Limitations\n\n* The chapters are based on the mp3 tracks. A single mp3 file will become a single m4b with 1 chapter, also if the mp3 filenames are garbarge then your m4b chapternames will be terrible as well.  See section on Chapters below for how to manually adjust.  \n* The conversion process actually strips some tags and covers from the files, which is why you need to use a tagger (mp3tag or beets.io) before adding to Plex.\n\n## Need ARM Support?\nChange the image to `spencermksmith/auto-m4b`\n\n## Using torrents and need to preserve seeding?\nIn the settings of your client add this line to `Run external program on torrent completion`, it will copy all finished torrent files to your \"recentlyadded\" folder:\n* `cp -r \"%F\" \"path/to/temp/recentlyadded\"`\n\n## How to use\nThis docker assumes the following folder structure:\n\n```sh\ntemp\n│\n└───recentlyadded # Input folder Add new books here\n│     │     book1.m4b\n│     |     book2.mp3\n|     └─────book3\n│           │   01-book3.mp3\n│           │   ... \n└───merge # folder the script uses to combine mp3's\n│     └─────book2\n│           │   01-book2.mp3\n│           │   ...\n└───untagged # Output folder where all m4b's wait to be tagged\n│     └─────book4\n│           │   book4.m4b\n└───delete # needed by the script\n|\n└───fix # Manually fix books\n|\n└───backup # Backups incase anything goes wrong\n      └─────book2\n            │   01-book2.mp3\n            │   ... \n```\n\n### Installation\n\n1. Create a `temp` folder and keep the location in mind for Step 6 \n2. Install docker https://docs.docker.com/engine/install/ubuntu/\n3. Manage docker as non-root https://docs.docker.com/engine/install/linux-postinstall/\n4. Install docker-compose https://docs.docker.com/compose/install/\n5. Create the compose file:  \n    `nano docker-compose.yml`\n6. Paste the yaml code below into the compose file, and change the volume mount locations\n7. Put a test mp3 in the /temp/recentlyadded directory.\n8. Start the docker (It should convert the mp3 and leave it in your /temp/untagged directory. It runs automatically every 5 min)  \n    `docker-compose up -d`\n### Example docker-compose.yml\n*  Replace the `/path/to/...` with your actual folder locations, but leave the `:` and everything after:  \n*  Replace the PUID and PGID with your user ( [?](https://www.carnaghan.com/knowledge-base/how-to-find-your-uiduserid-and-gidgroupid-in-linux-via-the-command-line/) )\n#### docker-compose.yml\n```yaml\nversion: '3.7'\nservices:\n  auto-m4b:\n    image: seanap/auto-m4b\n    container_name: auto-m4b\n    volumes:\n      - /path/to/config:/config\n      - /path/to/temp:/temp\n    environment:\n      - PUID=1000\n      - PGID=1000\n      - CPU_CORES=2\n      - SLEEPTIME=1m\n      - MAKE_BACKUP=Y\n```\n\n## To Manually Set Chapters:\n1. Put a folder with mp3's in the `/temp/recentlyadded` and let the script process the book like normal\n2. In the output folder ( `/temp/untagged` ) there will be a book folder that includes the recently converted *.m4b and a *.chapters.txt file.\n3. Open the chapters file and edit/add/rename, then save\n4. Move the book folder (which contains the m4b and chapters.txt files) to `/temp/merge`\n5. When the script runs it will re-chapterize the m4b and move it back to `/temp/untagged`\n\n## Advanced Options\n\n#### Edit the script that is run\nYou shouldn't need to change any options, but if you want to you will need to exec into the docker container. By default only vim text editor is installed, you will need to do a `apt-get update \u0026\u0026 apt-get install nano` if you want to use nano to edit the scipt.  \n* `docker exec -it auto-m4b sh -c 'vi auto-m4b-tool.sh'`  \n\n#### CPU Cores\nThe script will automatically use all CPU cores available, to change the amount of cpu cores for the converting change the `--jobs` flag in the m4b-tool command, but do not set it higher than the amount of cores available.  \n\n#### Backup Folder\nFor those copying files from another source into the `recentlyadded` folder, it might not make sense to waste time copying to the `backup` folder (because they were already copied from somewhere else).  Backing up is enabled by default.  To disable this copy operation, change this line in your compose file: `- MAKE_BACKUP=N`.\n\n#### More Reading\nMore m4b-tool options https://github.com/sandreas/m4b-tool#reference\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanap%2Fauto-m4b","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseanap%2Fauto-m4b","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseanap%2Fauto-m4b/lists"}