Editing category (genre) of audiobooks and other metadata for Books in OS X Catalina and Big Sur
With Catalina, Apple eliminated many features from Books (previously iBooks), including the ability to edit the category (genre) and other metadata of non-DRM audiobooks that were imported. ID3 tag editors can be used to edit most of the metadata fields such as title and author of mp3 files before importing to Books, but the Category such as Fiction, Poetry, etc. would either not change or appear blank in Books. After way too much experimentation I tracked down the problem:
There are two kinds of metadata associated with most audio files, the older Id3v1 and newer Id3v2. Id3v2 comes in three versions, v2.2, v2.3, and v2.4. In v2.2, metadata tags are internally represented by 3-character long strings, while in v2.3 and v2.4 they are represented by 4-character long string. In particular, in v2.2, the genre is represented internally by "TCO", whereas in v2.3/v2.4 it is represented by "TCON".
All current tagging software can read all versions of tags but can write only v1 and v3 / v4 tags, with the exception of OS X Music (previously iTunes). If an mp3 is imported into Music and it has no metadata, then Music will create v2.2 tags. If the file already has v2.3/v2.4 tags, it will continue to use that format.
Here is where the Books weirdness comes in. Books will read the genre tag (which becomes Category in list view) tag ONLY if the metadata is in v2.2 format and there are no v1 tags.
Here is a workflow that gets around these limitations/bugs. You need to install the command line program id3v2. It can be installed from MacPorts or HomeBrew. Suppose you have an audiobook named "foo" which consists of the files foo1.mp3, foo2.mp3, foo3.mp3 and you want to prepare it to import into Books.
- Print out the existing metadata for reference.
- id3v2 -l foo*.mp3
- Strip all the metadata from the files
- id3v2 -D foo*.mp3
- Add the files to Music
- Edit the metadata using the Get Info command
- Be sure to set "remember playback position" and "skip when shuffling"
- Music no longer lets you change the media type from Music to Audiobook, but that does not matter for this workflow.
- Export the files back to the Finder
- Strip out the v1 tags only
- id3v2 -s foo*.mp3
- Import the files to Books.
If your audiobooks are already in Books and you cannot access the original mp3 files, you can find them in the secret place where Books stores audiobooks. Audiobooks are stored in separate folders whose names are long random strings. The names of the audiobooks are derived from the metadata in the files, not the file or folder names. The files are the ridiculous location:
~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books/Audiobooks