Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saving image to m4b removes chapter marks #45

Closed
ElmoFuntz opened this issue Mar 27, 2019 · 29 comments
Closed

saving image to m4b removes chapter marks #45

ElmoFuntz opened this issue Mar 27, 2019 · 29 comments
Assignees
Labels

Comments

@ElmoFuntz
Copy link

M4b with chapter marks in it has them removed when using tageditor to save cover art to it. I don't know if the warning I get has anything to do with it but I get this

  • [100%] Calculating atom sizes and padding ...
  • [100%] Preparing streams ...
  • [100%] Writing header and tags ...
  • [100%] Reparsing output file ...
  • Changes have been applied.
  • Diagnostic messages:
    Warning 02:49:59 making mdhd atom: Assigned language "" is of an invalid format and will be ignored.

If I resort to adding the artwork via iTunes it works fine and chapters are retained.

@ElmoFuntz ElmoFuntz changed the title saving image to m4b remove chapter marks saving image to m4b removes chapter marks Mar 27, 2019
@Martchus
Copy link
Owner

Can you share a file to reproduce the issue?

@Martchus Martchus added the bug label Mar 27, 2019
@Martchus Martchus self-assigned this Mar 27, 2019
@ElmoFuntz
Copy link
Author

The file I was doing this on is copyrighted and rather large. I will try to chop a piece off and create a small dummy/test for you later today. What is the best way to share it? I can also provide the steps I was using to create the file. I am converting audio book cd's to m4b via an ffmpeg script I wrote and inserting the chapter marks/titles also via ffmpeg then was going to use your program to insert the cover art via command line since ffmpeg has an outstanding bug where it wont insert cover art last I checked and the suggestion was to use your program as a workaround.

@Martchus
Copy link
Owner

I will try to chop a piece off and create a small dummy/test for you later today.

Sounds good.

If the M4A file is the output of ffmpeg, you can also just send me the ffmpeg command to run. The original audio source shouldn't matter much except you're using -c:a copy. It would also good to know the exact tageditor command you've used on that file.

@ElmoFuntz
Copy link
Author

ElmoFuntz commented Mar 27, 2019

Sure Create file:
ffmpeg -i original.mp3 -vn -y -b:a 64k -acodec aac -ac 2 temp.m4a
Inset metadata:
ffmpeg -i metadata.txt -i temp.m4a -map_metadata 1 -codec copy Book.m4b
Metadata.txt looks like this:
;FFMETADATA1
narratedBy=Nick
date=2019
year=2019-01-15
artist=Andrew
album_artist=Andrew
album=test album
genre=Audiobook
copyright=©2018 Andrew
title=test title
author=Andrew
[CHAPTER]
TIMEBASE=1/1000
START=0
END=295354
title=Intro
[CHAPTER]
TIMEBASE=1/1000
START=295354
END=1127836
title=Recap
[CHAPTER]
TIMEBASE=1/1000
START=1127836
END=5227319
title=Chapter 1
[CHAPTER]
TIMEBASE=1/1000
START=5227319
END=7847737
title=Chapter 2
[CHAPTER]
TIMEBASE=1/1000
START=7847737
END=11114181
title=Chapter 3
[CHAPTER]
TIMEBASE=1/1000
START=11114181
END=15530570
title=Chapter 4
[CHAPTER]
TIMEBASE=1/1000
START=15530570
END=202437575
title=Chapter 5

When inserting the album art via tageditor I've tried both with the gui and using tageditor -s cover=cover.jpg --max-padding 100000 -f book.m4b

Both methods insert the cover art and kill the chapter marks.

@ElmoFuntz
Copy link
Author

Just to be sure I tried this with another audio file and a new metadata file and cover art and it still did the same thing.

@Martchus
Copy link
Owner

Ok, I'll do some tests when I have time.

Martchus added a commit to Martchus/tagparser that referenced this issue Mar 28, 2019
@Martchus
Copy link
Owner

i don't get Warning 02:49:59 making mdhd atom: Assigned language "" is of an invalid format and will be ignored. on an MP4/AAC file created with ffmpeg and your metadata file. And I also can not reproduce that chapters are removed. Maybe I need your exact MP4 file after all.

@ElmoFuntz
Copy link
Author

I tried it on 3 different files the 2nd one did not generate the warning but did kill the chapters. Just to be sure it wasn't size or tons of chapters I just created a small file tried again with the same results. I have attached this file with chapters. Insert any 500x500 jpg for the art.

I did notice I am getting this diagnostic message

Parsing chapters is not implemented for the container format of the file. parsing chapters
River.zip

@Martchus
Copy link
Owner

I can not reproduce the issue with your exact file. ffprobe, VLC and Media Info still show the characters after adding a cover using the same tageditor command as you. How do you test that chapters are gone? Maybe you're hitting a limitation of the player you're using?

The diagnostic message 'Parsing chapters is not implemented for the container format of the file.' is only info-level and can be ignored. It just means the chapters can not be displayed within the tag editor but of course they should still be preserved like every other aspect of the file which is unknown to the implementation.

@ElmoFuntz
Copy link
Author

I am loading it up into iTunes. Before hand there is a chapters menu and i can jump around chapters. Afterwards no menu and chapters are not displayed nor can I select them. I have not tried it on my iPhone but I expect the results to be the same.

@Martchus
Copy link
Owner

Martchus commented Mar 30, 2019

I don't use iTunes. Strange that it can not display the chapters of a file processed by the tag editor while VLC, Media Info and ffprobe still can. Seems like a limitation in iTunes too me.

What happens if you remove the cover again? If iTunes shows then the menue again we know that no information is lost when the tag editor applies changes and only iTunes can not handle such files.

What happens if your add the cover using iTunes itself? It shouldn't produce a file it can not handle itself so we would know what the expected file structure is.

@ElmoFuntz
Copy link
Author

Removing the cover art does not make the chapters work again. Adding the cover art via iTunes works and keeps the chapters intact. I also tested on my iPhone and after adding cover art via tageditor chapters no longer work on it either. I see what you mean about ffprobe though. I do see them listed both before and after...

@Martchus
Copy link
Owner

Martchus commented Apr 1, 2019

Can you share that "intact" file produced by iTunes to know what we're aiming for?

@ElmoFuntz
Copy link
Author

River2.zip
Ok renamed the original file I shared to River.m4b loaded it into iTunes and attached a cover image. It is attached.

@Martchus
Copy link
Owner

Thanks for providing that file. Apparently the gmhd atom is discarded by the tag editor which is definitely a bug since the tag editor should preserve unknown parts of the file as much as possible.

I also noticed that the order of the atoms chpl and mvhd in River2.zip is different. But that's actually a change on the iTunes side.

@Martchus
Copy link
Owner

Does the following file work in iTunes? RiverTagged.zip

If it does I have a fix :-)

Martchus added a commit to Martchus/tagparser that referenced this issue Apr 15, 2019
@ElmoFuntz
Copy link
Author

It shows a cover but no chapters. Is there a new version I should try?

@Martchus
Copy link
Owner

It shows a cover but no chapters.

Then there's likely also some other element missing.

Is there a new version I should try?

You would have to build the application with commit Martchus/tagparser@2d306b1 yourself if you wanted to test it yourself.

@Martchus
Copy link
Owner

Maybe it is the order of the elements. Does the following file work in iTunes? RiverTagged2.zip

Martchus added a commit to Martchus/tagparser that referenced this issue Apr 16, 2019
@ElmoFuntz
Copy link
Author

No same thing. Unfortunately no way for me to build or I'd try it locally.

@Martchus
Copy link
Owner

Developing this is a little bit trail and error. So does the following file work in iTunes? RiverTagged3.zip I've noticed that the tag editor discards a certain atom due to a bug. Maybe iTunes does not like that, too.

By the way, the bug I've found know is not limited to the iTunes and chapters. So thanks for reporting - it already helps me to improve.

Unfortunately no way for me to build or I'd try it locally.

Likely not worth the effort anyways (unless you really want to help me coding C++).

@ElmoFuntz
Copy link
Author

No sadly still the same results.

I "sorta" gave up on C++ I sucked at pointers sadly (and played too many games in school lol) more of a C# dabbler but very much a hobby. I do appreciate you looking at this and I'm willing to try as many versions as needed just unfortunate our time zones only permit 1 try a day usually.

@Martchus
Copy link
Owner

Provides iTunes any parsing errors/warnings? And is something else broken with the file, e.g. track durations not shown or tracks completely missing? Because the only difference I still see is that the tag editor uses a newer version of the mdhd atom than the original file - and that part of the file contains timing information for the track. Maybe iTunes only supports version 0.

I could let the tag editor write version 0 as well for better compatibility (unless version 1 is required).

@ElmoFuntz
Copy link
Author

HHG.zip
No no errors although there might be some slight popping at the chapters or it could just be a crappy recording. I have attached a 2nd file to test with that has chapter marks every 60 seconds (total of 5) and cover art.

You might be on to something I noticed when I edited some tracks in mp3tag that several fields were not where I was expecting after updating first in iTunes then in mp3tag... meaning the tags all showed up with what I had edited into each but only in the fields I had entered in each one (program) its possible iTunes was using one version of the tag and mp3tag another.

@Martchus
Copy link
Owner

Seems like my tag editor sets the wrong track type for those chapter tracks. This is actually visible in MediaInfo as well. But the following file should be fixed - at least considering MediaInfo: RiverTagged4.zip

Does it also work in iTunes?

@ElmoFuntz
Copy link
Author

We have a winner! That one works. Chapters and cover art show up.

@ElmoFuntz
Copy link
Author

Any eta on a release with the fix?

@Martchus
Copy link
Owner

v3.2.1 which was released 2 days ago should have the fix.

@ElmoFuntz
Copy link
Author

Oops forgot to recheck ha! New version seems to do the trick. Loaded up a full chapterized book, put in the metadata and cover art and it kept the chapters and performs as expected. Thanks for all the work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants