m4b-tool
m4b-tool copied to clipboard
REQUEST: Add `narrator` and `publisher` options for metadata fields
I've been trying to get my books to align with the converted Audible books I already have in my library and I was wondering if it was possible to add the narrator
and publisher
tags that they use in the metadata for their books.
As far as I can tell, the keys used for these fields are ©nrt
and ©pub
respectively. I know there are a few tools you use in the tech stack for this app but I'm not sure which part of it you use for the metadata tagging, so I'm not sure how straightforward this is, but I figured I'd ask!
Here is a complete list of an example Audible book's metadata tags as provided by the tool jsmediatags:
{
"type": "MP4",
"ftyp": "aax ",
"version": 1,
"tags": {
"©nam": {
"id": "©nam",
"size": 70,
"description": "Title",
"data": "Ender's Game: Special 20th Anniversary Edition"
},
"@pti": {
"id": "@pti",
"size": 62,
"description": "Unknown",
"data": "A World of Sci-Fi & Fantasy Collection"
},
"@PST": {
"id": "@PST",
"size": 74,
"description": "Unknown",
"data": "Ender's Game 20th Anniversary Edition (Unabridged)"
},
"©ART": {
"id": "©ART",
"size": 40,
"description": "Artist",
"data": "Orson Scott Card"
},
"aART": {
"id": "aART",
"size": 40,
"description": "Album Artist",
"data": "Orson Scott Card"
},
"©alb": {
"id": "©alb",
"size": 75,
"description": "Album",
"data": "Ender's Game: 20th Anniversary Edition (Unabridged)"
},
"©gen": {
"id": "©gen",
"size": 33,
"description": "Genre",
"data": "Audiobook"
},
"prID": {
"id": "prID",
"size": 38,
"description": "Unknown",
"data": "BK_ALIT_000164"
},
"©cmt": {
"id": "©cmt",
"size": 193,
"description": "Comment",
"data": "The war with the Buggers has been raging for a hundred years, and the quest for the perfect general has been underway for almost as long. Enter Andrew \"Ender\" Wiggin...."
},
"©des": {
"id": "©des",
"size": 438,
"description": "Unknown",
"data": "Why we think it’s a great listen: It’s easy to say that when it comes to sci-fi you either love it or you hate it. But with \nEnder’s Game, it seems to be you either love it or you love it.... The war with the Buggers has been raging for a hundred years, and the quest for the perfect general has been underway for almost as long. Enter Andrew \"Ender\" Wiggin, the result of decades of genetic experimentation."
},
"cprt": {
"id": "cprt",
"size": 115,
"description": "Copyright",
"data": "©1977, 1985, 1991 Orson Scott Card (P)2002 Fantastic Audio, an imprint of Audio Literature"
},
"©pub": {
"id": "©pub",
"size": 39,
"description": "Unknown",
"data": "Macmillan Audio"
},
"©day": {
"id": "©day",
"size": 28,
"description": "Release Date",
"data": "2002"
},
"©nrt": {
"id": "©nrt",
"size": 74,
"description": "Unknown",
"data": "Stefan Rudnicki, Harlan Ellison, Gabrielle de Cuir"
},
"CDEK": {
"id": "CDEK",
"size": 34,
"description": "Unknown",
"data": "B002V5A12Y"
},
"CDET": {
"id": "CDET",
"size": 28,
"description": "Unknown",
"data": "ADBL"
},
"VERS": {
"id": "VERS",
"size": 25,
"description": "Unknown",
"data": "4"
},
"GUID": {
"id": "GUID",
"size": 37,
"description": "Unknown",
"data": "ABGYJE5P3BHXU"
},
"AACR": {
"id": "AACR",
"size": 55,
"description": "Unknown",
"data": "CR!BJCNGDC8P91XVD3628AHMBK53T5W"
},
"@ppi": {
"id": "@ppi",
"size": 38,
"description": "Unknown",
"data": "BK_AREN_000508"
},
"PASN": {
"id": "PASN",
"size": 34,
"description": "Unknown",
"data": "B002VEU3J6"
},
"@sti": {
"id": "@sti",
"size": 70,
"description": "Unknown",
"data": "Ender's Game: Special 20th Anniversary Edition"
},
"rldt": {
"id": "rldt",
"size": 35,
"description": "Unknown",
"data": "30-DEC-2001"
},
"ausr": {
"id": "ausr",
"size": 100,
"description": "Unknown",
"data": "J{ͥd>\tsP蒓̔\u000fF6%ĝ玝Ȕ֙X(bb\u0004W\u001eFĭ%\u0006Ef,ՙ\u0003\u0016ALIT_000164"
},
"title": "Ender's Game: Special 20th Anniversary Edition",
"artist": "Orson Scott Card",
"album": "Ender's Game: 20th Anniversary Edition (Unabridged)",
"year": "2002",
"comment": "The war with the Buggers has been raging for a hundred years, and the quest for the perfect general has been underway for almost as long. Enter Andrew \"Ender\" Wiggin....",
"genre": "Audiobook"
}
}
if it was possible to add the narrator and publisher tags that they use in the metadata for their books.
It would be possible, but unfortunately this is not already built in. This is also not implemented in m4b-tool
itself, but in mp4v2
, which is a toolset, that is used for editing m4b
files (which internally is m4a
, while mp4
is the container spec). I already forked mp4v2
to fix some issues and patch in some options like sort-name
, etc. but I'm not the maintainer of the main project.
As far as I can tell, the keys used for these fields are ©nrt and ©pub respectively.
Yes, that is correct. mp4
is separated in so called atoms, which define the different tag fields and options. To add them, I would have to:
- Add a command line option for the field (
narrator
) - Add the Atom, so that it could be used in the code
The problem is, that mp4v2
uses a limited set of command line options, that MUST exist in form of a single char. It would be a pretty big effort, to reimplement this for supporting other parameter types (e.g. --long-only-option
). Due to this fact, the amount of options still available is pretty low. See
https://github.com/sandreas/mp4v2/blob/1272bc04d6274a0cdfd8b52570fd68e61daa53a6/util/mp4tags.cpp#L73
I already experimented with narrator
in a branch, but since this field is ignored by iTunes (which is my main reason to build m4b-tool
), I did not move it into master, because of the low option count remaining. To see my patch, here is the link: https://github.com/TechSmith/mp4v2/compare/master...sandreas:encoding-tool-option#
I do not know any player supporting your requested fields. So my question is: Why are you trying to add narrator
and publisher
?
I asked because I host my Audiobooks on Plex and access them using an iPhone app called Prologue. It uses these fields to display the info on the app:
If its an insane amount of work, I wouldn't want to put you out, but these just seem to be pretty standard fields to have for an audiobook. I know people often use composer
for the narrator but its ultimately not very semantically accurate, and it would be nice to have an option specifically for it.
I'm also building my own web app which implements this tool and it would be nice to be able to replicate the audible tag format as much as possible for consistency within the app itself (for grabbing data out of the files and displaying it)
If its an insane amount of work
Nah, I don't think it would be that much work and your feature request is totally valid. The problem lies more within the limitations of mp4v2
implementation, my lack of skills in the C
programming language and the fact, that this would break the compatibility of my fork of mp4v2
in a way, that will make it impossible to submit a PR for improvements. I recently found a possible replacement option for mp4v2
, but I would need to write a C#
utility for reading and writing tags.
I also had an idea to extend the available amount of input options from a-z, A-Z
to maybe other ASCII chars like 0-9
, @
or !
. I will try that. Even if that would not be very elegant, it maybe will work.
I know people often use composer for the narrator but its ultimately not very semantically accurate
This is exactly the way I see it, although narrator
is not part of the official MP4 specs, but only of the Quicktime
extension.
I'm also building my own web app which implements this tool
Awesome. Is it open source? Maybe there is something to learn.
OK, as a conclusion, I will leave this issue open and think about a solution without including too many dirty hacks. Here is a little todo list:
- [ ] Implement option for ©nrt and ©pub in
mp4v2
(see branchencoding-tool-option
https://github.com/sandreas/mp4v2/blob/encoding-tool-option/util/mp4tags.cpp) - [ ] Update hash for
brew
setup - [ ] Implement these options in
m4b-tool
(Tag
class, command line params) - [ ] Integrate both implementations, so that it works together
Unfortunately I think this will take a while... maybe you can workaround this with exiftool
or other tagging tools, that support these atoms
? :-)
No worries if it takes a while, I just figured I'd ask! Thanks for taking the time to consider it!
And as far as my project goes, it's a tool for downloading and converting books from various online libraries (OverDrive, Audible, cloudLibrary), so I haven't decided whether or not to make it public yet because of its nature (legality wise).
However, I invited you to have read access on the repo in case you want to check out the source code! It's still very much a work in progress though so some of the organization is a little rough.
I did just add an editor for the chapters and metadata which is really what I wanted to make it for.
If you check it out, let me know what you think!
Looks promising :-) I accepted the invite, maybe it's a good idea to have a meetup some day. ATM I'm pretty busy :-)
Looks promising :-) I accepted the invite, maybe it's a good idea to have a meetup some day. ATM I'm pretty busy :-)
Haha yeah a meetup could be a good idea! It seems like we've implemented a lot of the same functionality in our apps. I haven't had a chance to figure out all of the features you've added since the last official version you have but it seems like you have a lot of similar Audible metadata grabbing haha. Could be fun to hash some ideas out sometime!
It would be great to understand how all of your improvers work haha, I can't really tell how to go about triggering them. It would probably make my life easier if I could apply the tags using a json file but I'm not really sure how to format them,
There are some news on this issue: I am preparing to use tone
for tagging (instead of mp4v2
or ffmpeg
). The code is already integrated, but currently inactive, due to some Known Issues.
Tone supports narrator
and publisher
out of the box and as soon as all known issues are fixed I'll try to integrate these into m4b-tool
. If you would like to use it earlier, you just have to use tone manually for the following tags:
-
movement-name
:--meta-movement-name
(Series) -
movement
:--meta-part
(Series part) -
narrator
:--meta-narrator
-
publisher
:--meta-publisher
What do you think?
@sandreas I checked tone out before, it looks cool! The metadata tagging seems pretty straightforward, however I'm on an M1 Mac and I made the issue on tone a while ago about it crashing every time I tried to use it. Any updates on that?
https://github.com/sandreas/tone/issues/6
however I'm on an M1 Mac
Oh, that was your problem. Sorry, I forgot.
Any updates on that?
Maybe the new release just works?! (v0.0.5) You may try it, but you could try to compile it yourself. It is not that hard to do. Install dotnet core 6 SDK on your macOS, e.g. via brew:
brew install --cask dotnet-sdk
then:
git clone https://github.com/sandreas/tone.git
cd tone
git checkout tags/v0.0.5 # this is not required, but if you would like to get to the "stable" state
dotnet restore
cd tone
# use osx.11.0-arm64 on Big Sur
dotnet publish -r osx.12-arm64 --self-contained -c Release -o ./dist tone.csproj
cd dist
./tone --version
Now the only thing you have to do is, move tone
to a place in your path, like you would install the downloaded file. That's it.
I would love to get feedback on this. Maybe this could be a good instruction for those people using M1 macs.
Hmm, nope, I gave those commands a shot and I'm still getting a bus error.
Hmm, nope, I gave those commands a shot and I'm still getting a bus error.
Thanks for the report and trying the build. I think that a failure when compiling on the SAME machine might mean that C# has still some problems running on M1 (see https://github.com/dotnet/runtime/issues/66302).
Maybe the new docker image can help out... I will try to update the dotnet version as soon as possible, maybe dotnet 7 will fix this.
@csandman So this should already be fixed with latest m4b-tool
/ tone
(0.1.5). Will also try to publish the new docker image as soon as possible.
Haha awesome! Man, can't believe this issue was from two years ago haha
Haha awesome! Man, can't believe this issue was from two years ago haha
Yeah, me too. My focus went more to UI programming and my proxmox home-server. I also had a big paid project over the last months so I couldn't do much about m4b-tool
and tone
. In November I have some time left :-)