sandreas / m4b-tagger

Cross Plattform GUI Tool to tag, split, join and edit m4b files
MIT License
3 stars 0 forks source link

How to use this #1

Closed Derp0 closed 5 years ago

Derp0 commented 5 years ago

Hello,

Can you please update the readme with instructions on how to use this to edit chapters of m4b files?

sandreas commented 5 years ago

Hello,

unfortunately this project still is an empty skeleton without any release. The good news: There is an command line alternative project that pretty much does everything i've been originally planning for this project:

https://github.com/sandreas/m4b-tool

But if you prefer a GUI, you could also use: https://github.com/gonzoua/AudioBookBinder (MacOS) https://github.com/yermak/AudioBookConverter

Derp0 commented 5 years ago

Thanks for the reply. I saw your CLI before this GUI but it's too... how do I say it... complicated for my needs; I just need to manipulate the chapters and leave everything else as is. I checked out those other apps and many more too but they alter the m4b files' metadata other than the chapters, e.g. one would delete the Description tag (@des) and only keep the Comment tag while the other would copy one tag into the other one.

Currently I'm doing it with mp4v2 (mp4chaps) like this:

  1. Export the chapters with this in a .bat file: mp4chaps --export %1%
  2. Edit the resultant txt file
  3. And finally import the changes with this: mp4chaps --verbose 3 --optimize --import %1%

I found out adding --optimize makes them more similar to the original m4b if you're interested.

Most of the tagging is done correctly when I convert my Audible titles to m4b with a tool which I'm reluctant to mention its name here; only chapters aren't handled well so I'd have to correct them manually.

sandreas commented 5 years ago

I saw your CLI before this GUI but it's too... how do I say it... complicated for my needs

I understand... m4b-tool is designed as power user tool that fits very specific needs (my needs in general ;-)


I checked out those other apps and many more too but they alter the m4b files' metadata other than the chapters, e.g. one would delete the Description tag (@des) and only keep the Comment tag while the other would copy one tag into the other one.

Yeah thats exactly what happened to me and why i developed m4b-tool :-) Other tools that might fit your needs:

Perhaps you did not test all of them...


Currently I'm doing it with mp4v2 (mp4chaps) like this:

Yeah this is a pretty good workflow.


I found out adding --optimize makes them more similar to the original m4b if you're interested.

May I ask what you exactly mean with that? I did never understand, what the optimize does exactly but this would be nice to know... the official documentation is not really helpful...

-z, --optimize       optimize mp4 file after modification

Most of the tagging is done correctly when I convert my Audible titles to m4b with a tool which I'm reluctant; only chapters aren't handled well so I'd have to correct them manually.

I think i get, what you are trying to tell me... but: Because chapters are a problem I'm trying to solve at the moment with m4b-tool, perhaps i also may ask you some questions:

It would be very helpful to get feedback about how important chapters are for users and how they are trying to embed them into audiobooks.

Derp0 commented 5 years ago

I understand... m4b-tool is designed as power user tool that fits very specific needs (my needs in general ;-)

Mind you I'm not too big on GUIs, I just preferred this over m4b-tool because it fitted my needs, i.e. just metadata editing.

Drax: https://www.videohelp.com/software/Drax

Thanks, gonna try this one, already tested the others.

May I ask what you exactly mean with that? I did never understand, what the optimize does exactly but this would be nice to know...

I don't know much either, I think it's like the optimisation in MKV files, making the file smaller and arranging the metadata, tags, etc. in an optimal way at the cost of a second run. I didn't really do a thorough inspection; just created a diff file between the original and the new m4b file with and without --optimize option. The diff file was bigger (~1.6 MB) without --optimize (meaning more difference) compared to when --optimize was used (just a few KBs). Also did a quick comparison in a hex editor, with --optimize the 2 files looked more similar.

Are you adjusting only the chapter positions or also care manually about the chapter names?

I haven't found an audiobook whose chapters are misplaced and need adjusting yet, so I'm only adjusting the names manually right now.

If you also edit the chapter names, where do you find the original chapter names?

I've been unable to find a reliable database for audiobooks to get such info so what I do is try several places for chapter names, like:

  1. MusicBrainz (Picard has a plugin which can save chapters along with their names in a cuesheet file)
  2. Sometimes others post individual chapters (split) with their names on YT, reddit, etc.
  3. Audible sometimes provides PDFs with a "Contents" (or Index) page in them, which contains the chapter names, along with some audiobooks. Maybe this can be done using other services which provide PDFs. Gets really tiresome doing it manually though, especially if the book has 100+ chapters.

Will let you know when I find a good database.

Which language? (I'm german, so i prefer german audio books)

I have to download from Audible's German website, but I download English audiobooks because I don't know German :).

It would be very helpful to get feedback about how important chapters are for users and how they are trying to embed them into audiobooks.

Personally they are important to me and I spend time correcting them as best I can, but they might not be important at all to some users.

Derp0 commented 5 years ago
@item --optimize
optimize mp4 structure.
This will rewrite the entire mp4 file which, if needed, will clean up
any unused (free) sections, and re-order the atoms in a manner somewhat
consistent with the best-practices described in the ISO base media file
specification.

From here: https://github.com/TechSmith/mp4v2

sandreas commented 5 years ago

--optimize

Thanks for pointing this out. In my understanding it just re-organises but no real changes are made - so it is ok to prevent it

I've been unable to find a reliable database for audiobooks to get such info so what I do is try several places for chapter names

Yeah, so have I... The only real source is audible (which does not provide chapters for many audiobooks, i think about 20% have REAL chapters) or if you own the epub. m4b-tool does support chapter extraction of an existing epub in the latest release. These extracted chapters can be matched automatically on the tracks, which worked out quite well for me (in 60% of the test cases the chapters were a successful match).

Will let you know when I find a good database.

I'm working on such a database. But it will take an unspecified amount of time, since I'm pretty busy - it is planned for m4b-tool 0.5.0. I would really appreciate if you provide your handcrafted chapter sets, as soon as it is available :-) I plan to make this possible on the website or via m4b-tool publish... The counterpart of this database would be m4b-tool merge and m4b-tool chapters to load and embed chapters into audiobooks. Perhaps this might be interesting for you, if it is ready. If so, keep an eye on m4b-tool - i will publish it in this project.

Derp0 commented 5 years ago

Thanks for pointing this out. In my understanding it just re-organises but no real changes are made - so it is ok to prevent it

You're welcome. Yeah, you can avoid this if you don't want to increase the time when editing m4b's, this could take quite a long time especially on large files. It just provides slightly smaller files with clean (standard) metadata structure.

The only real source is audible (which does not provide chapters for many audiobooks, i think about 20% have REAL chapters) or if you own the epub.

Some of them have correct chapter positions (like Chapter one is really chapter 1, 2 is 2 and so forth), but mostly several chapters are packed into one chapter. Haven't seen correct chapter names at all, only generic ones.

m4b-tool does support chapter extraction of an existing epub in the latest release.

Interesting feature. Does it also work if chapter positions are not correct or they must be corrected manually beforehand?

I'm currently pulling chapter names from goodreads previews and chapter positions using Audacity's "Silence finder". I've only been able to chapterise two audiobooks this way because it takes a long time doing it manually (100+ chapters). But I'm confident with a well-written script this can be done faster.

I would really appreciate if you provide your handcrafted chapter sets, as soon as it is available :-)

Sure, would be happy to help since I'm interested in this, but another medium of communication is needed for that purpose I think.

I think a website where users can share their corrected CUE files would be fantastic.

sandreas commented 5 years ago

Some of them have correct chapter positions (like Chapter one is really chapter 1, 2 is 2 and so forth)...

Yes, but i prefer having a more expressive name, so i implemented an algorithm, that can detect consecutive numbered chapters and if detected its able to add the first words of the chapter... like:

Chapter 1 - Peter tells Helen to take...
Chapter 2 - "What?" asks Helen...
...

If not, it keeps the chapter name in original. Additionally i hate chapters that are too long. So m4b-tool is able to split too long (and only too long) chapters by silence with --max-chapter-length=300,900, where 300 stands for the desired chapter length (5 mins), where silences are targeted and 900 for the absolute maximum (15 mins), where a hard break is used, if no silence is found. This results in:

Chapter 1 - Peter tells Helen to take... (1)
Chapter 1 - Peter tells Helen to take... (2)
Chapter 1 - Peter tells Helen to take... (3)
Chapter 2 - "What?" asks Helen... (1)
Chapter 2 - "What?" asks Helen... (2)
...

Interesting feature. Does it also work if chapter positions are not correct...

It maps the chapter position by text length of the epub chapter - so chapters with much text are mapped to long audio chapters and vice versa. Before this, a silence detection ensures, that the chapter positions are not shifted. If there are more chapters in audio as in the book, it works pretty good, if there are less audio chapters than book chapters, it wont work as well and most of the chapters will be misplaced.

There is also a parameter to ignore epub chapters that are not present in the audio book - like --ignore-chapter-indexes=0,1,-1,-2 which will ignore chapters like

0 Title
1 Table of contents
...
-2 About the author
-1 Related books

I'm currently pulling chapter names from goodreads previews and chapter positions using Audacity's "Silence finder".

Yeah, thats what m4b-tagger was planned for... an easy way to manually place chapters by marking all silences and skipping through till a chapter is found. But manual chapter adjustment was just too much effort without any possibility of solving this problem.

Another approach was to detect all silences and then using speech to text to detect the name of the chapters and mark them, but the project (mozilla common voice) is not yet sufficiently developed.

I think a website where users can share their corrected CUE files would be fantastic.

The website is planned to allow:

As well as display all of these formats via tabs...

You see that i thought A LOT about this topic, but there is more to come :-)

but another medium of communication is needed for that purpose I think.

Yeah, I'll reach out ;) But for now i think i go for making the chapter website production ready... Thank you for your extensive feedback.

Derp0 commented 4 years ago

Sorry, been away for a while.

Yes, but i prefer having a more expressive name

Me too, for example, I chaptered Bertrand Russell's A History of Western Philosophy like this:

Preface
Introduction
1.1. The Rise of Greek Civilisation
1.2. The Milesian School
1.3. Pythagoras
1.4. Heraclitus
1.5. Parmenides
1.6. Empedocles
...

Sometimes they get too long so I avoid adding unnecessary spaces or things like "Chapter".

It maps the chapter position by text length of the epub chapter - so chapters with much text are mapped to long audio chapters and vice versa.

Good idea! And about the silence detection, I found out that it doesn't work efficiently on some audiobooks because instead of silence before a chapter there's actually music. That is Audacity's silence finder, yours might fare better.

There is also a parameter to ignore epub chapters that are not present in the audio book - like --ignore-chapter-indexes=0,1,-1,-2 which will ignore chapters like

Another brilliant idea!

You see that i thought A LOT about this topic, but there is more to come

Yeah, you certainly have. Good to hear.

I think this chapter website would solve a lot of the problems, maybe it could also offer other metadata as well, would be really cool.

Thank you for your extensive feedback.

You're welcome, and good luck.