When saving m4b nero chapters are incorrectly written

This is tested on v3 and 2.94. I use mp3tag to ocassionally fix artwork or album detail on m4b files and have noticed that mp3tag is incorrectly rewriting the nero style chapters in my files. It's been doing this for awhile and I never noticed because iTunes uses the QT chapters and ignores the nero chapters but pretty much everything else uses the nero chapters if they exist.

Example of what happens when you simply select an m4b and save making no changes. Check file in MediaInfo and you see (hundreds of chapters snipped out to save space) this as original.

General
Complete name                            : D:\test.m4b
Format                                   : MPEG-4
Format profile                           : Apple audio with iTunes info
Codec ID                                 : M4A  (isom/iso2)
File size                                : 1.22 GiB
Duration                                 : 43 h 20 min
Overall bit rate mode                    : Constant
Overall bit rate                         : 67.0 kb/s
Album                                    : The Wandering Inn 01: The Wandering Inn
Track name                               : The Wandering Inn

Menu #1
ID                                       : 2
Codec ID                                 : text
Duration                                 : 43 h 20 min
Language                                 : English
Bit rate mode                            : CBR
Menu For                                 : 1
00:00:00.000                             : Segment 001
00:10:00.000                             : Segment 002
..snip..
43:00:00.000                             : Segment 259
43:10:00.000                             : Segment 260

Menu #2
00:00:00.000                             : Segment 001
00:10:00.000                             : Segment 002
..snip..
42:10:00.000                             : Segment 254
42:20:00.000                             : Segment 255

now save the file and you see this for chapters (the rest remains the same)

Menu #1
ID                                       : 2
Codec ID                                 : text
Duration                                 : 43 h 20 min
Language                                 : English
Bit rate mode                            : CBR
Menu For                                 : 1
00:00:00.000                             : Segment 001
00:10:00.000                             : Segment 002
..snip..
43:00:00.000                             : Segment 259
43:10:00.000                             : Segment 260

Menu #2
00:00:00.000                             : The Wandering Inn
00:10:00.000                             : The Wandering Inn
..snip..
42:10:00.000                             : The Wandering Inn
42:20:00.000                             : The Wandering Inn

It appears to be taking the track name field and replacing all of the chapter names with it. This is bad.Menu #2 is the nero style chapters. Menu #1 is QT. BTW Yes i am aware the 2 sets of menus are different (more chapters in menu 1) and this is perfectly acceptable.

I've tried this with various combinations of files and chapters now and could not reproduce. Can you give more detailed steps?

Have you enabled "List chapters as separate files" at "Options > Tags > Advanced" or does this happen when you save the global tag?

No that option is cleared.

I can't really provide any more details. I literally open an m4b file and do nothing other than save it. I just spot checked a directory of about 150 m4b's I did exactly that with (I did this because it appears m3ptag converts the tag type from MP4 to MP4 Nero on initial save which was taking a long time to do the first save when making simple changes like adding album art or updating titles) and every single file I checked has been modified this way. Is it possible the tag conversion process is doing it? Please let me know what additional info you might need such as settings etc.

Edit

I tried it with "List chapters as separate files" which does save the chapters differently (still not correctly) EXCEPT it does it with the incorrect data. Here is why

  • Open file with chapters
  • The title field is populated with the "Track name" field from the main file and placed in the title column (which it appears you are using to indicate the chapter name) even though there is preexisting chapter information that is totally different.
  • Save now and it will overwrite all the NERO chapter data with the track name information and REMOVE it from the main MP4 container

Before

Album : The Wandering Inn 01: The Wandering Inn
Track name : The Wandering Inn
Track name/Position : 1
Performer : Pirate Aba

After

Album : The Wandering Inn 01: The Wandering Inn
Track name/Position : 1
Performer : Pirate Aba

  • Modify any of the title fields from above process and save again and this modified value is updated and saved in the NERO tag (it is not saved in the QT tag).

So if all of your chapter information was only ever done in mp3tag you won't see the problems above because mp3tag will read back in its own tags. My test files were created using ffmpeg and several other chapter editors depending on when they were done.

BTW The use of the title column for chapter name really does not make sense and is one of several reasons why I disabled this display. You need a new one called chapter when this mode is enabled.

So even more weird stuff related to this that I just discovered when responding to your reply in my other post.

  • Take an m4b or m4a and strip the Nero chapters out using ffmpeg so that only QuickTime Chapters exist. The command is

ffmpeg -i test.m4b -codec copy -map 0:0 -movflags disable_chpl output.m4b

  • Examine the file using a tool such as MediaInfo you will see only 1 set of chapters in my case the chapters were named chapter 1, chapter 2, etc

  • Open the file in mp3tag with the "List chapters as separate files" option enabled. All chapters are displayed with a name of the MP4 container title (IE the title field if you were to right click the file in windows and edit the metadata using the built in windows properties editor. Same field used for mp3's).

  • Save the file without making any changes and mp3tag creates a whole new set of chapter menus for the Nero tags and uses the title previously mentioned in every single line. It does not touch the QuickTime tags.

So it appears mp3tag can notice that QT chapters exist but it handles the translation wrong or is not reading the data correctly and it does not know how to write them at all. This is in addition to writing back a new incorrect set of Nero chapters.

Here are some screenshots to help out (I had to get creative due to the 3 file limit)

Stripped of Nero chapters only QT showing now

Saved file in mp3tag and now have 2 sets and bottom set is the title.

Thanks for reporting the issue with the newly added Nero chapters are using the global tags title instead of the chapter titles of existing QT chapters.

I've created an internal unofficial build of Mp3tag for you which should fix the issue:

https://download.mp3tag.de/support/0621794E-BA8C-4BBF-A84D-ACED48444553-3022/mp3tagv300bsetup.exe

Regarding Mp3tag not being able to write or update existing QT chapters — Yes, this is a limitation of the feature. As I've mentioned in the changelog:

[2019-01-06] NEW: added support for reading and removing QuickTime chapter information.

Writing QT chapters is on my internal wish list.

BTW please let me know if you need anything else on this. I like using your program and am eager to see this one fixed. I unfortunately ended up with several hundred files with bad Nero chapter data already before I noticed it. Thanks for all the work you put into this!

Edit wow you beat me to it as I was writing this. I will give it a try tonight. I have to leave for work shortly.

1 Like

This appears to be fixed now. It is correctly reading, displaying, and writing chapters out.

A bonus would be if you were able to add a new a column header for chapters of course instead of reusing title. An additional new addition would be a column that displays the play position in the entire file instead of just the length of the chapter. This is already provided in the metadata so should be simple to display.

I did discover one additional issue/oddity whole testing this. In an attempt to "delete a chapter" I removed the meta data for one of the chapters and while Mediainfo shows the chapter gone your program shows a blank line. This is probably related to the other item I reported?

Thanks for trying out and confirming the fix.

I understand why this would be useful (seeing both title and chapter title at once and being able to edit it).

However, it would probably break some other parts: Mp3tag would then display an artificial field, e.g., CHAPTERTITLE which would need some special treatment. Would adding this field to a file then add a new chapter? Probably yes, but by that this field name would have quite some power in changing the underlying structure of the file. Also, would removing this field remove the chapter with the corresponding timestamps? Probably yes, but it's not very transparent.

No, it's not related but related to what I've described above. Mp3tag has not chapter editor at the moment. It simple displays existing information and is, in parts (cf. no QT chapters edits atm), able to change their contents. It's not possible to add new chapters or remove individual existing ones. Having a full-fledged chapter editor is on my internal wish list though.

Now fixed officially with Mp3tag v3.00c.