m4b-tool
m4b-tool copied to clipboard
Just the last 10 files are used when merging an Audiobook with 42 files
Hello Andreas, First of all thanks a lot for this wonderfull application. its helping me alot :).
My scenario: I am merging 42 files to an m4b audiobook, but m4b-tool is just using the last 10 files. The weird thing, if I put the last 10 files to another folder and try it again, all 33 Files are merged. Don't really understand what is going on here. Regarding the files there is no difference in coding and tags, as they are all ripped with the same coding configuration and I have put the same tagging information to all files.
System: I am using debian buster in a wsl 2 environment on Windows 10 Education 2004, docker for windows in wsl2 and the docker container build with the provided code here on the github
I have attached some pictures.
These are the files, that are merged
with this command:
FOLDER=Ausgefressen
m4b-tool merge ./"$FOLDER/" --jobs 4 --use-filenames-as-chapters --no-chapter-reindexing --no-conversion --force --output-file="$FOLDER.m4b"
(the absolute path is a folder in my home directory, if you need it tell me)
Result respectively generated chapters.txt file
This is the second scenario, where all 33 files in the folder are merged:
Same command as above:
m4b-tool merge ./"$FOLDER/" --jobs 4 --use-filenames-as-chapters --no-chapter-reindexing --no-conversion --force --output-file="$FOLDER.m4b"
Result:

Maybe you can help? If you need anything else tell me I will try to provide any helping information.
Update: Just tried another file. Same Results. But here the Chapters go from 50 to 73.
Thanks for reporting so detailed... Which version are you using? If you are using 0.4.2 you could try the latest pre-release.
Currently I'm working on a complete rewrite of the chapter logic, so this also might fix this issue.
Can you try with --debug? Also, technically, the command with variable should be like:
./"$FOLDER"/ and --output-file="$FOLDER".m4b, though I doubt that would cause this specific of an issue.
Hey there. I'll close this ticket in about 3 days on no further feedback. Feel free to reopen if the problem persists.
I'm having this same issue, using the latest commit in master I built my own docker image, and some books it only grabs the last 10 files, and I even have one that it only grabs one file and it's not even the first/last it's just a random file in the middle... The book has 66 files total and it only converts Chapter 51.
I used --debug and I don't see anything useful in the output that gives a clue as to why it's only grabbing one file...
Command used:
docker run -it --rm -v D:/Workareas/Workarea-Books/!AudioConversion:/mnt incryptosoft/m4b-tool merge -v --debug --jobs=4 --output-file="output/" --use-filenames-as-chapters --batch-pattern="input/%a/%s/%p - %n/" --batch-pattern="input/%a/%n/" "input/"
MP3 Tags: I wiped all tags from the MP3 files and only have the following set...
ALBUM = Children of Captain Grand
ARTIST = Jules Verne
YEAR = 1868
TRACK = <01-66>
TITLE = Chapter <01-66>
UPDATE: I ran another book that has 266 files in it, it merged 225 of them and skipped the rest... very odd behavior, it doesn't seem to be a certain number that its skipping, I've gone through and deleted the id3 tags from the files and re-written them from scratch, tried regenerating the file names to make sure there wasn't something weird with an invalid character. I'm at a loss.
Log Output:
DEBUG 5ms ffmpeg -hide_banner -codecs
NOTICE 13ms determine highest available audio codec
NOTICE 376ms 0 matches for pattern input/%a/%s/%p - %n/
NOTICE 384ms
NOTICE 393ms ================================
DEBUG 400ms ffmpeg -hide_banner -codecs
NOTICE 408ms determine highest available audio codec
NOTICE 797ms 1 match for pattern input/%a/%n/
NOTICE 805ms ================================
NOTICE 813ms merge input/Jules Verne/Children of Captain Grant/
NOTICE 821ms => output/Jules Verne/Children of Captain Grant/Children of Captain Grant.m4b
NOTICE 829ms - name: Children of Captain Grant
NOTICE 838ms - artist: Jules Verne
NOTICE 847ms
NOTICE 856ms ================================
NOTICE 864ms
NOTICE 872ms ================================
NOTICE 879ms processing input/Jules Verne/Children of Captain Grant/
DEBUG 888ms ffmpeg -hide_banner -codecs
NOTICE 895ms determine highest available audio codec
DEBUG 1177ms == load input files ==
NOTICE 1316ms reading metadata and streaminfo for file /mnt/input/Jules Verne/Children of Captain Grant/Chapter 51.mp3
DEBUG 1326ms ffmpeg -hide_banner -i "/mnt/input/Jules Verne/Children of Captain Grant/Chapter 51.mp3" -f ffmetadata -
DEBUG 1589ms ;FFMETADATA1
album=Children of Captain Grant
artist=Jules Verne
title=Chapter 51
date=1868
encoder=Lavf58.29.100
[mp3 @ 0x55555659cdc0] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '/mnt/input/Jules Verne/Children of Captain Grant/Chapter 51.mp3':
Metadata:
album : Children of Captain Grant
artist : Jules Verne
title : Chapter 51
date : 1868
Duration: 00:16:18.71, start: 0.000000, bitrate: 48 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 48 kb/s
Output #0, ffmetadata, to 'pipe:':
Metadata:
album : Children of Captain Grant
artist : Jules Verne
title : Chapter 51
date : 1868
encoder : Lavf58.29.100
Stream mapping:
Press [q] to stop, [?] for help
size= 0kB time=-577014:32:22.77 bitrate=N/A speed=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded
DEBUG 1625ms ffmpeg -hide_banner -i "/mnt/input/Jules Verne/Children of Captain Grant/Chapter 51.mp3" -f null -
NOTICE 2896ms
DEBUG 2912ms
[mp3 @ 0x555555759dc0] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from '/mnt/input/Jules Verne/Children of Captain Grant/Chapter 51.mp3':
Metadata:
album : Children of Captain Grant
artist : Jules Verne
title : Chapter 51
date : 1868
Duration: 00:16:18.71, start: 0.000000, bitrate: 48 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 48 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
Metadata:
album : Children of Captain Grant
artist : Jules Verne
title : Chapter 51
date : 1868
encoder : Lavf58.29.100
Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
Metadata:
encoder : Lavc58.54.100 pcm_s16le
size=N/A time=00:07:16.21 bitrate=N/A speed= 872x
size=N/A time=00:14:28.15 bitrate=N/A speed= 868x
size=N/A time=00:16:23.30 bitrate=N/A speed= 870x
video:0kB audio:84694kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
NOTICE 2946ms searching for cover in input/Jules Verne/Children of Captain Grant
NOTICE 2992ms using cover input/Jules Verne/Children of Captain Grant/cover.png
NOTICE 3004ms searching for description.txt in input/Jules Verne/Children of Captain Grant
DEBUG 3015ms checking file input/Jules Verne/Children of Captain Grant/description.txt, realpath:
NOTICE 3027ms file description.txt not found or too big
NOTICE 3150ms preparing conversion with 1 simultaneous job, please wait...
NOTICE 126205ms using cover input/Jules Verne/Children of Captain Grant/cover.png
NOTICE 126213ms searching for chapters.txt in input/Jules Verne/Children of Captain Grant
DEBUG 126223ms checking file input/Jules Verne/Children of Captain Grant/chapters.txt, realpath:
NOTICE 126234ms file chapters.txt not found or too big
NOTICE 126240ms rebuilding chapters from converted files title tags
DEBUG 127241ms ffmpeg -hide_banner -f concat -safe 0 -vn -i "output/Jules Verne/Children of Captain Grant/Children of Captain Grant.m4b.listing.txt" -max_muxing_queue_size 9999 -c copy -f mp4 "output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b"
NOTICE 127247ms merging output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b, this can take a while
NOTICE 136510ms
DEBUG 136533ms tagging file output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b with tag:
M4bTool\Audio\Tag Object
(
[encoder] => m4b-tool
[title] => Children of Captain Grant
[sortTitle] =>
[artist] => Jules Verne
[sortArtist] =>
[genre] =>
[writer] =>
[album] => Children of Captain Grant
[sortAlbum] =>
[disk] =>
[disks] =>
[albumArtist] =>
[year] => 1868
[track] =>
[tracks] =>
[cover] => SplFileInfo Object
(
[pathName:SplFileInfo:private] => input/Jules Verne/Children of Captain Grant/cover.png
[fileName:SplFileInfo:private] => cover.png
)
[description] =>
[longDescription] =>
[comment] =>
[copyright] =>
[encodedBy] =>
[performer] =>
[language] =>
[publisher] =>
[lyrics] =>
[chapters] => Array
(
[0] => M4bTool\Audio\Chapter Object
(
[name:protected] => 51
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 0
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 983324
)
)
[1] => M4bTool\Audio\Chapter Object
(
[name:protected] => 52
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 983324
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 839833
)
)
[2] => M4bTool\Audio\Chapter Object
(
[name:protected] => 53
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1823157
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 858720
)
)
[3] => M4bTool\Audio\Chapter Object
(
[name:protected] => 54
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 2681877
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 685554
)
)
[4] => M4bTool\Audio\Chapter Object
(
[name:protected] => 55
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 3367431
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1001662
)
)
[5] => M4bTool\Audio\Chapter Object
(
[name:protected] => 56
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 4369093
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1094266
)
)
[6] => M4bTool\Audio\Chapter Object
(
[name:protected] => 57
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 5463359
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1150064
)
)
[7] => M4bTool\Audio\Chapter Object
(
[name:protected] => 58
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 6613423
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1438351
)
)
[8] => M4bTool\Audio\Chapter Object
(
[name:protected] => 59
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 8051774
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1124960
)
)
[9] => M4bTool\Audio\Chapter Object
(
[name:protected] => 60
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 9176734
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1224068
)
)
[10] => M4bTool\Audio\Chapter Object
(
[name:protected] => 61
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 10400802
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 999363
)
)
[11] => M4bTool\Audio\Chapter Object
(
[name:protected] => 62
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 11400165
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 941188
)
)
[12] => M4bTool\Audio\Chapter Object
(
[name:protected] => 63
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 12341353
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1326155
)
)
[13] => M4bTool\Audio\Chapter Object
(
[name:protected] => 64
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 13667508
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1141939
)
)
[14] => M4bTool\Audio\Chapter Object
(
[name:protected] => 65
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 14809447
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 1451281
)
)
[15] => M4bTool\Audio\Chapter Object
(
[name:protected] => 66
[tag:protected] =>
[start:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 16260728
)
[length:protected] => Sandreas\Time\TimeUnit Object
(
[milliseconds:protected] => 479004
)
)
)
[series] =>
[seriesPart] =>
)
DEBUG 136546ms file output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b is an MP4 file
DEBUG 136558ms mp4tags -help
NOTICE 136566ms check for sorting support in mp4tags
NOTICE 136843ms supported, proceeding...
DEBUG 136867ms mp4tags -song "Children of Captain Grant" -artist "Jules Verne" -year 1868 -album "Children of Captain Grant" -encodedby m4b-tool -type 2 "output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b"
NOTICE 136887ms tagging file output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b
NOTICE 138156ms
DEBUG 138182ms mp4art --add "input/Jules Verne/Children of Captain Grant/cover.png" "output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b" -f
NOTICE 138191ms adding cover input/Jules Verne/Children of Captain Grant/cover.png to output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b
NOTICE 139467ms
DEBUG 139484ms adding input/Jules Verne/Children of Captain Grant/cover.png -> output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b
DEBUG 139517ms mp4chaps -i "output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b"
NOTICE 139523ms importing chapters for output/Jules Verne/Children of Captain Grant/Children of Captain Grant-tmpfiles//tmp_Children of Captain Grant.m4b
NOTICE 140783ms
Sorry I have just forgotten completely about my report. I think I have solved it by using the latest pre-release version. Well actually I am not completely sure as I have used your tool on other audiobooks than the one I have reported, but there everything went well. If I have time I will try it again on the reported audiobook and report again
@incryptosoft A solution could be to use the latest pre-release version: docker build . --build-arg M4B_TOOL_DOWNLOAD_LINK=https://github.com/sandreas/m4b-tool/files/5683619/m4b-tool.tar.gz -t m4b-tool This was the command I used.
@dmuiX Thanks for giving this advice... like I already said: It has been a long time since the last stable release and I try to finish the next release as soon as possible, but unfortunately I'm very busy atm.
BTW: Others reported that the latest pre-release did NOT FIX it, but this needs careful investigation, which may take some time.
Thanks a lot for your comment sandreas. Yeah this was my thought, too there has not been an release for a long time :D. No Problem.
Interesting. I will try it again and see what happens. For the last 3 Audiobooks I have created everything went well with chapters...
Another solution for anybody who is looking for creating audiobooks might be to use this application. audiobookcreator Unfortunately its just for Windows PC. Don't know if its working in Wine.
@sandreas if you don't want that kind of advertisement, i can understand that, you can say it and i delete it. But i thought it could be helpful for people coming here ;). This was my solution for the problems I had the first time.
Additional Information:
I messed around with various combinations trying to determine what the issue might be. What I came up with is that any combination that I do where the input folder is inside the folder that was mounted (e.g. my command contains -v /d/convert:/mnt) it fails to find all of the files. If I first copy the input folder to another location INSIDE the container it works fine (with and without patterns)...
So I start the docker container and change the entrypoint to /bin/sh, copy /mnt/input to /tmp/input, run my conversion which finds all files and converts perfectly fine (with /mnt/output/ as the output folder), delete /tmp/input/ and exit, and it's perfect.
I am going to test this on a linux box to see if it's something specific to reading the files from a mounted folder on windows or on any distro.
I am running the latest pre-release that is posted.
Don't know if it helps you, but I just write what am I using at the moment:
For me everything is working fine with this command in my .zshrc on a Mac OSX: alias m4b-tool='docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd)":/mnt m4b-tool'
I put every m4a file written like Kapitel 01.m4a, Kapitel 02.m4a, ... in a folder and then create the audiobook with this command: m4b-tool merge "./" --jobs 4 --use-filenames-as-chapters --no-chapter-reindexing -vvvv --no-conversion --output-file "Somebook.m4b"
Haven't tried it on Windows though...last time it was not working for me, but there I haven't used the pre-release. So could be a Windows Problem. Good Luck on Linux :)
On my maschine the problem is solved with the use of the current pre-release docker version. :) Have tried converting the audiobook from my original post and it is created correctly.
I'm still seeing this issue actually. Running a docker build on windows using the latest master commit: https://github.com/sandreas/m4b-tool/commit/1c33feb3600415ceced69da42891812196b436a3
Trying to combine 102 M4B files and it's only grabbing the last ~68 of them.
docker run -it --rm -v `"D:\Media\iTunes\iTunes Media\Audiobooks\Cornelia Funke`":/mnt m4b-tool merge . --no-conversion --output-file="Dragon Rider.m4b" --use-filenames-as-chapters --name="Dragon Rider")

Side note, the ability to use the --merge-similar in the merge operation would be handy for this particular book, but when I try to run it as a part of the chapters operation, I'm getting this:
Command:
docker run -it --rm -v `"D:\Media\iTunes\iTunes Media\Audiobooks\Cornelia Funke`":/mnt m4b-tool chapters --merge-similar ".\Dragon Rider.m4b")
Result:
PHP Fatal error: Uncaught TypeError: Argument 3 passed to M4bTool\Chapter\ChapterMarker::guessChaptersBySilences() must be an instance of Sandreas\Time\TimeUnit, null given, called in phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Command/ChaptersCommand.php on line 177 and defined in phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Chapter/ChapterMarker.php:33
Stack trace:
#0 phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Command/ChaptersCommand.php(177): M4bTool\Chapter\ChapterMarker->guessChaptersBySilences(Array, Array, NULL)
#1 phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Command/ChaptersCommand.php(128): M4bTool\Command\ChaptersCommand->buildChapters(Array)
#2 phar:///usr/local/bin/m4b-tool/vendor/symfony/console/Command/Command.php(255): M4bTool\Command\ChaptersCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 phar:///usr/local/bin/m4b-tool/vendor/symfony/console/Application.php(908): Symfony\Component\Console\Command\Command-> in phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Chapter/ChapterMarker.php on line 33
an error occured, that has not been caught:
Array
(
[type] => 1
[message] => Uncaught TypeError: Argument 3 passed to M4bTool\Chapter\ChapterMarker::guessChaptersBySilences() must be an instance of Sandreas\Time\TimeUnit, null given, called in phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Command/ChaptersCommand.php on line 177 and defined in phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Chapter/ChapterMarker.php:33
Stack trace:
#0 phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Command/ChaptersCommand.php(177): M4bTool\Chapter\ChapterMarker->guessChaptersBySilences(Array, Array, NULL)
#1 phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Command/ChaptersCommand.php(128): M4bTool\Command\ChaptersCommand->buildChapters(Array)
#2 phar:///usr/local/bin/m4b-tool/vendor/symfony/console/Command/Command.php(255): M4bTool\Command\ChaptersCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 phar:///usr/local/bin/m4b-tool/vendor/symfony/console/Application.php(908): Symfony\Component\Console\Command\Command->
[file] => phar:///usr/local/bin/m4b-tool/src/library/M4bTool/Chapter/ChapterMarker.php
[line] => 33
)
Ok, since this seems to be a problem, I'll reopen the issue and try to investigate further... although I don't think that it will be easy to reproduce / fix, since this seems to be very random.
Appreciate it! Let me know if I can help in any way. I'm not super skilled in PHP, but I'm good at testing stuff and retrieving logs!
Ok, I improved the logging with the latest pre-release. Would be awesome, if someone could try to reproduce the problem with --debug and provide the logfile.
Thanks @incryptosoft for the workaround idea. Worked great.
@sandreas attached a m4b-tool.log. Skips the first 35 (out of 90) files in my case. Running on docker (through Docker for Windows). Moving the files to the container proper (copied from the volume) worked as noted above.
docker run -it --rm -v C:\...\workdir:/mnt m4b-tool merge --skip-cover --jobs=16 -vv --debug . -o Malice.m4b
I have the exact same behavior with my files as well. Can run some logs if you want me to.
Yeah logs would be good to have, although I don't believe that I can do something about it. What we could try is to find a generic solution without mounting the device via docker, but via SMB, SSHFS or any other fs layer
I was having the same issue on windows. I managed to fix it by turning off "Use the WSL 2 based engine". Since doing that its working perfectly
I was having the same issue on windows. I managed to fix it by turning off "Use the WSL 2 based engine". Since doing that its working perfectly
Great find. Thank you for reporting this.
Using what nerd-king stated earlier as a starting point I did a test as well. Initially, I mounted the following Volumes. These /mnt/media is actually a SMB Volume mounted to my Docker Host VM. When I do this, the merge is unable to merge all of the mp3s and will even get some out of order for whatever reason.
- /mnt/media/_todo/audiobookconvert/temp:/temp
- /mnt/media/_todo/audiobookconvert/original:/original
- /mnt/media/_todo/audiobookconvert/backup:/backup
I then decided to try manipulating the original mount point by mounting the original folder to a local location on the Docker Host VM as opposed to a mounted SMB Volume on the Docker Host VM and everything just started working. My SMB mount Volume mounted to /mnt/media is a TrueNAS server. Do not know if I am running into a potential IOPS issue, a SMB protocol issue, a mv command issue within the auto-m4b-tool.sh script, or some oddball issue.
- /mnt/media/_todo/audiobookconvert/temp:/temp
- /home/myuser/test:/original
- /mnt/media/_todo/audiobookconvert/backup:/backup
So I have ran several tests and they have been successful. I first filezilla my book with mp3s to my /home/myuser/test folder on my Docker Host VM and I let the m4b-tool Docker VM do its thing where it copies a backup to the mounted SMB Volume on my TrueNAS and then I get the converted m4b file from the TrueNAS mounted SMB Volume.
Maybe I will introduce a --copy-source-file-to-tmp boolean option to just copy the source file to the tmp path BEFORE converting and try if this fixes the problem... but it's pretty hard to fix this without the ability to reproduce it.
I tried my best, also on Windows, but I did not reproduce the problem so far... I leave this open just to have some options to try for the people expieriencing this....
I don't know about anyone else but this is a cool tool. Now that I have a solution/work-around to the issue, it definitely makes my life easier and will definitely be using it more. I literally just ran across this tool yesterday and started using it today. Thanks for the work you put into it. I was just trying to help everyone try to narrow down the issue.
Maybe I will introduce a
--copy-source-file-to-tmpboolean option to just copy the source file to the tmp path BEFORE converting and try if this fixes the problem... but it's pretty hard to fix this without the ability to reproduce it.I tried my best, also on Windows, but I did not reproduce the problem so far... I leave this open just to have some options to try for the people expieriencing this....
When trying to reproduce, is your docker on WSL2? I think that may be the underlying issue (much slower drive access maybe?)
When trying to reproduce, is your docker on WSL2? I think that may be the underlying issue (much slower drive access maybe?)
I basically tried EVERYTHING except having a slower harddisk / SSD (All of my systems use NVMe)... While that might be the problem in reproducing this error, I really tried on Linux, MacOS, Windows 10 with WSL1 and WSL2 and I've put A LOT of effort into this. The only things I can think of are new specific settings or retry mechanisms in m4b-tool to workaround the problem - not directly fixing it. I'm pretty sure this is a docker thing, but hey, if I can help, I'll try. Maybe in the future I be able to reproduce... For now, I'll stick with the hints in this ticket.
When trying to reproduce, is your docker on WSL2? I think that may be the underlying issue (much slower drive access maybe?)
I basically tried EVERYTHING except having a slower harddisk / SSD (All of my systems use NVMe)... While that might be the problem in reproducing this error, I really tried on Linux, MacOS, Windows 10 with WSL1 and WSL2 and I've put A LOT of effort into this. The only things I can think of are new specific settings or retry mechanisms in
m4b-toolto workaround the problem - not directly fixing it. I'm pretty sure this is adockerthing, but hey, if I can help, I'll try. Maybe in the future I be able to reproduce... For now, I'll stick with the hints in this ticket.
Strange! Mine was happening on a nvme drive so don’t think it’s hdd related. That said , I agree it’s a docker or WSL problem. Will try the workaround option next time I have a m4b to merge and report back.
Will try the workaround option next time I have a m4b to merge and report back.
I'm not sure when it is gonna happen... the workaround is planned, but does not exist atm.
Well then I’ll submit a PR next time!
I was having a heck of a time with this issue as well. Running on Windows 11 targeting WSL2. No matter what I tried certain input files would get skipped. I had two books that had 94 and 95 chapters, but whenever I ran the script from a windows drive (D: in my image below) it would drop chapters 1-42. Every time....
What worked for me was migrating fully to the WSL2 distribution (Ubuntu). I created the directory structure directly on the WSL filesystem and copied my script (largely based on this one) with the minor path updates. Now when I run the script all chapters are included in the output.

Ok, I'll try to provide a workaround in the next days here. I experimented with integrating ls and find to get a list of the files and I don't know, if this will fix the problem, but at least it is worth a try to use a native file listing utility to check the file list and do extensive logging.
Probably I'll provide a flag --file-listing-provider=find or something... stay tuned.