Closed MituButChi closed 2 years ago
Thank you for reporting this issue... unfortunately, m4b-tool
is for power users, so the instructions might be frustrating to read for a person, who is not an expert of command line and linux... I understand that.
But as you provided detailed errors, please let me ask you the following questions:
m4b-tool
are you using? (m4b-tool --version
)Probably you are using 0.4.2
, which is outdated by far (unfortunately, I did not have the time to provide another release - m4b-tool
is a maintainers mess :-). If so, you should upgrade to latest pre-release, see instructions.
I plan to iron out the roughest edges asap, but it will take some time...
The docker image is highly recommended, because it is a preconfigured all in one easy to install VM-ish environment, where you just need one command and you are done... to install docker, you have to follow the instructions for your OS - once installed, it is two commands to get m4b-tool
up and running.
unfortunately, m4b-tool is for power users, so the instructions might be frustrating to read for a person, who is not an expert of command line and linux...
Yes that applies for a lot of things on GitHub. I've accepted my faith actually, and just try my best. It just takes me a loooooot more time and effort than people with programming expertise.
Sorry I should have specified.
2021-06-04
one.
At first I was using the 4.0.2 but then I found another topic where you said it's outdated, so I switched to a pre-release version. I tried the top one and it didn't work, I didn't want to try the 2nd one because it says BE CAREFUL in all caps, so I settled with the 3rd.I'll try to find a tutorial for the docker image. In the meantime could you help me with the issue above? Thank you.
So after a lot of tutorials, I successfully set up Docker and managed to pulled the m4b-tool.
I couldn't set up the alias though. I tried pasting these in the command prompt, nothing worked.
alias m4b-tool='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt sandreas/m4b-tool:latest'
'alias' is not recognized as an internal or external command, operable program or batch file.
docker alias m4b-tool='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt sandreas/m4b-tool:latest'
unknown shorthand flag: 'i' in -it See 'docker --help'. Usage: docker [OPTIONS] COMMAND A self-sufficient runtime for containers [...]
I doubt this one is the correct one though.
docker run sandreas/m4b-tool:latest alias m4b-tool='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt sandreas/m4b-tool:latest'
Unable to find image 'sandreas/mb4-tool:latest' locally docker: Error response from daemon: pull access denied for sandreas/mb4-tool, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. See 'docker run --help'.
I logged in to my Docker Desktop. And I have it running the whole time. The image has a green In Use
tag in Docker.
Which is the right command for alias?
So now everytime I run a command, I have to use:
docker run sandreas/m4b-tool merge "M:\audiobooks\audiobook maker\input\" --output-file="M:\merged.m4b"
But it still doesn't work. Here's the error message:
--output-file is required
trace: #0 phar:///usr/local/bin/m4b-tool-pre/vendor/symfony/console/Command/Command.php(255): M4bTool\Command\MergeCommand->execute()
#1 phar:///usr/local/bin/m4b-tool-pre/vendor/symfony/console/Application.php(1009): Symfony\Component\Console\Command\Command->run()
#2 phar:///usr/local/bin/m4b-tool-pre/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#3 phar:///usr/local/bin/m4b-tool-pre/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#4 phar:///usr/local/bin/m4b-tool-pre/bin/m4b-tool.php(47): Symfony\Component\Console\Application->run()
#5 /usr/local/bin/m4b-tool-pre(10): require('...')
#6 {main}
I also tried the split command:
docker run sandreas/m4b-tool split --audio-format mp3 --audio-bitrate 96k --audio-channels 1 --audio-samplerate 22050 "C:\audiobooks\1.m4b"
It says:
In AbstractCommand.php line 390:
Input is not a file
split [--logfile [LOGFILE]] [--debug] [-f|--force] [--tmp-dir [TMP-DIR]] [--no-cleanup] [--no-cache] [--ffmpeg-threads [FFMPEG-THREADS]] [--platform-charset [PLATFORM-CHARSET]] [--ffmpeg-param [FFMPEG-PARAM]] [-a|--silence-min-length [SILENCE-MIN-LENGTH]] [-b|--silence-max-length [SILENCE-MAX-LENGTH]] [--max-chapter-length [MAX-CHAPTER-LENGTH]] [--name [NAME]] [--sortname [SORTNAME]] [--album [ALBUM]] [--sortalbum [SORTALBUM]] [--artist [ARTIST]] [--sortartist [SORTARTIST]] [--genre [GENRE]] [--writer [WRITER]] [--albumartist [ALBUMARTIST]] [--year [YEAR]] [--description [DESCRIPTION]] [--longdesc [LONGDESC]] [--comment [COMMENT]] [--copyright [COPYRIGHT]] [--encoded-by [ENCODED-BY]] [--grouping [GROUPING]] [--purchase-date [PURCHASE-DATE]] [--encoder [ENCODER]] [--cover [COVER]] [--skip-cover-if-exists] [--skip-cover] [--series [SERIES]] [--series-part [SERIES-PART]] [--remove [REMOVE]] [--ignore-source-tags] [--prefer-metadata-tags] [--audio-format [AUDIO-FORMAT]] [--audio-extension [AUDIO-EXTENSION]] [--audio-channels [AUDIO-CHANNELS]] [--audio-bitrate [AUDIO-BITRATE]] [--audio-samplerate [AUDIO-SAMPLERATE]] [--audio-codec [AUDIO-CODEC]] [--audio-quality [AUDIO-QUALITY]] [--audio-profile [AUDIO-PROFILE]] [--adjust-for-ipod] [--use-nero-chapter-format] [--fix-mime-type] [--no-conversion] [--trim-silence] [--add-silence [ADD-SILENCE]] [-o|--output-dir [OUTPUT-DIR]] [-p|--filename-template [FILENAME-TEMPLATE]] [--use-existing-chapters-file] [--reindex-chapters] [--fixed-length [FIXED-LENGTH]] [--chapters-filename [CHAPTERS-FILENAME]] [--by-silence] [--] <input>
What should I do now?
Ok, now you are on the right track... the problem is, that docker cannot access your files because you are using ABSOLUTE PATHS...
M:
seems to be a network share... that will not work you have to copy your files locally. Lets say, that
C:\Users\MituButChi\audiobooks_input\
and are organized like C:\Users\MituButChi\audiobooks_input\<Genre>\<Author>\<Title>\
OR C:\Users\MituButChi\audiobooks_input\<Genre>\<Author>\<Series>\<SeriesPart> - <Title>
C:\Users\MituButChi\audiobooks\
You could use:
cd C:\Users\MituButChi\
# the path must be provided relatively with slashes (NOT C:\Users\MituButChi\audiobooks_input\ but only audiobooks_input/)
docker run -it --rm -v "$PWD":/mnt sandreas/m4b-tool:latest merge -v --jobs=2 --output-file="audiobooks/" --max-chapter-length=300,900 --adjust-for-ipod --batch-pattern="audiobooks_input/%g/%a/%s/%p - %n/" --batch-pattern="audiobooks_input/%g/%a/%n/" "audiobooks_input/"
To split a file, the same rules apply:
# assuming the file to split is C:\Users\MituButChi\audiobooks_to_split\my-audio-book.m4b
cd C:\Users\MituButChi\
docker run -it --rm -v "$PWD":/mnt sandreas/m4b-tool:latest split --audio-format mp3 --audio-bitrate 96k --audio-channels 1 --audio-samplerate 22050 "audiobooks_to_split/my-audio-book.m4b"
Good luck :-)
Thank you for your quick reply.
I was about to edit my comment because after some playing around I understood it a bit more.
Could you please tell me how to set the alias? It has to do with the command prompt and not docker right? If it's too complicated to explain then it's all good, I'd just use the long commands instead.
M:
seems to be a network share... that will not work you have to copy your files locally.
No actually I changed my local disk to M:
because that's my initial haha. Sorry for the confusion.
So I tried to use the merge
and split
command now and here's what it says:
docker: Error response from daemon: create $PWD: "$PWD" includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended to pass a host directory, use absolute path.
See 'docker run --help'.
Now what do I do?
You can replace $PWD
by the directory, you are trying to work with:
# split audio book C:\Users\MituButChi\audiobooks_to_split\my-audio-book.m4b
docker run -it --rm -v "C:\Users\MituButChi\":/mnt sandreas/m4b-tool:latest split --audio-format mp3 --audio-bitrate 96k --audio-channels 1 --audio-samplerate 22050 "audiobooks_to_split/my-audio-book.m4b"
Note that on windows docker shares are very different because of permissions. Maybe you have to add C:
or in your case M:
to the local mounts / permissions.
I would go for a simplification first and try to put one sample audiobook to C:/Users/<your-username>/
and then try it there with the command above. As soon as it works, you can try to move your directories around and go for M:
or something.
Close this to open another issue dedicated to split command.
Hi. I finally got the tool up and running after hours of trials and errors cuz I don't know anything about programming and little experience working with audio files. After all I'm glad I managed to make it work.
Now when I'm using the tool, it shows me a message like this:
The
split
command doesn't work correctly:ffmpeg 5.0.1
withlibfdk_aac
compiled in, so I don't know why it's telling me the installed version is 0.2.0.The
merge
command works fine but it also shows the PHP_OS_FAMILY error.I installed
PHP 7.1.32
. I added PHP 7.1, phar folder, ffmpeg and mp4v2 to my Environment Variables. I wanted to build docker image like you recommended but I didn't understand anything about the instruction, it's like reading a foreign language. Is that the problem here?Thank you for creating this tool. I'd really appreciate the help.