m4b-tool
m4b-tool copied to clipboard
Merged file is incorrect length
I am trying to make n m4b file from several mp3 files and a chapter.txt file. Everything seems to be going fine but the resulting file is only 29ish hours and the mp3 files total to over 50 hours. The m4b files in the tmp folder total to the correct time so something wrong is happening after the conversion takes place.
The command I used is: m4b-tool -vv merge "The Way of Kings/" --genre "Epic Fantasy" --writer "Brandon Sanderson" --year "2010" --series "The Stormlight Archive Arc 1" --output-file="The Way of Kings.m4b"
Attached is the chapters.txt file I am using. chapters.txt
I am not sure why this isn't working because I have used this successfully many times now.
The other thing I notice is the resulting file seems to show up in vlc as "The Way of Kings - Part 01" even though the file name is "The Way of Kings.m4b" but there also doesn't seem to be a part 2 anywhere.
What exactly am I doing wrong here?
This might be a problem with my directory scanner... I came across this a few times in my own collection but i was not able to reproduce it. If your mp3 files are separated into multiple directories like this:
cd1/001.mp3
cd1/002.mp3
# ...
cd3/001.mp3
#...
cover.jpg
description.txt
# ...
it might help to put everything into one directory (if possible). But I'll check this in the next weeks, I'm still busy, but it is getting a bit better :-)
All the files are in one folder already. It's really weird. Does anything look off in the command I used or the chapters.txt file?
Of course if you are busy now don't worry about it. It's no rush :)
You can add the --debug flag and check the logfile, maybe it tells you something. Be careful to remove personal information if you would like to provide it in this issue.
I managed to copy the separate m4b files to a different directory before they were deleted automatically and their total time was correct. I ran this command from that folder and got the attached log file
m4b-tool -vv --no-conversion merge . --genre "Epic Fantasy" --writer "Brandon Sanderson" --year "2010" --series "The Stormlight Archive Arc 1" --output-file="The Way of Kings.m4b" --debug
I didn't see any personal information I cared about in the file so it is un-edited
Should be fixed with the latest pre-release (see also #122)
Seems to still be a problem. Attached is the new log file: m4b-tool.log
Edit: also now the temp files are not being deleted, which was only a problem when using --no-conversion which didn't do this time, as I wanted to test the original command.
It is weird, when I try it on the m4b files with this command it seems to work fine but actually the final file is too long now.
m4b-tool -vv --no-conversion merge . --genre "Epic Fantasy" --writer "Brandon Sanderson" --year "2010" --series "The Stormlight Archive Arc 1" --output-file="The Way of Kings.m4b" --debug
And it's its still not working with the mp3s
Ok, then I have to take a look again :-)
I improved the logging with the latest pre-release. Would you mind running the ORIGINAL command, that you would like to use (not where you tried to fix it by saving the temporary files) with extra --debug flag and provide the resulting logfile?
Beware that this file might contain user specific or sensitive information, that you might wanna remove.
Note: Using
--debugpreserves all temporary files automatically - no need for tricks
Mmh, everything looks good to me. The 46 files are being converted and merged correctly.
There is a chapters.txt file showing a length of 45:29:09.088 (+ the length of the last track, which should be negligible)... is this accurate? If so, how long is the resulting file instead?
I had a problem like this once in my whole collection and I was not able to fix this with ffmpeg. In my opinion the problem must have been ffmpeg, because with fdkaac everything worked. Since you are using the docker image, maybe you give it a try... append --audio-profile=aac_he to use fdkaac instead of ffmpeg. The resulting file should be very similar, maybe it takes a bit longer.

So you can see in these two screenshots. The playlist of mp3 files is 45 hours something but the m4b file is only 29 hours. Also for some reason the m4b shows up as "Part 01" in the playlist even though its only one file and the file name doesn't have "Part 01" in it.
Edit: I'm not using docker.
Also for some reason the m4b shows up as "Part 01" in the playlist even though its only one file and the file name doesn't have "Part 01" in it.
This is the album Tag... since you are not providing all possible tags, m4b-tool tries to preserve the tags already present in the source mp3 files. If you don't like that, you have multiple options:
--ignore-source-tags- will leave all the tags empty, that are not specified--album="manual value"- you can set the album manually--equate="title,album"- set the value ofalbumto the same value astitle
The logfiles also show, that you may improve some of the tag fields:
INFO 1344345ms sortalbum : The Stormlight Archive Arc 1 -
INFO 1344345ms sortname : The Stormlight Archive Arc 1 -
INFO 1344343ms series : The Stormlight Archive Arc 1
The playlist of mp3 files is 45 hours something but the m4b file is only 29 hours.
So the resulting file is too short, this would mean that some content is missing - which is remarkable, because the logs say, that 46 files have been converted and the concat listing of ffmpeg also shows, that the 46 converted files have been merged correctly. So I suspect some kind of ffmpeg misbehaviour here, like I described above
With
sudo pacman -S fdkaac
you maybe would be able to use the --audio-profile=aac_he option, I described above. You could also try to up/downgrade ffmpeg, but in my case with the bogus mp3 files, that did not help.
Closed, because this issue is pretty old. If the problem still occurs and bothers you, feel free to reopen.