Plex and Audiobooks

Making Plex do things it wasn't really meant to do.

In a couple of weeks I’ll be driving to Montreal with my dad for the Canadian Grand Prix. We’re excited for this, for various reasons. We have made this trip a few times now (2014 and 2015), and we’re used to the long drive which is about 12 hours from Columbus. To pass the time, we listen to various podcasts and audiobooks. In the past, I have been pretty terrible about managing my audiobooks. I decided to try and fix that this week, using Plex of course.

Pre-Plex Cleanup

As I said before, my collection was a mess. I had books organized into folders by author and maybe series, files were inconsistently named, and file types were not uniform. Before even trying to get them into Plex, the files needed some love.

Converting to MP3

The first step was to convert everything to mp3. This was very easy, since almost all the files were already .mp3. But a few books were m4a (one was .m4b which means it was an iTunes book and thus useless, another was .aa which I’m pretty sure is Audible and thus also useless). Luckily, Bash on Windows is here to help. FFmpeg is easy to install in the subsystem and a little loop to convert all files in a folder:

> for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -ab 128k "${f%.m4a}.mp3"; done
> rm *.m4a

The conversion can be kind of slow considering the length of the files, but it got the job done. If quality is important, then you can replace 128k with 256k, but I’m dealing with audiobooks which don’t need a high bitrate to sound fine.

Merging Books to a Single File

The next step was to combine files. Almost every audiobook was split into multiple files. Some were single files, some were three, some were 39. Again, Bash on Windows to the rescue! Mp3Wrap takes any number of .mp3 files and spits out a single, concatenated version. It can be installed with apt like FFmpeg and is incredibly easy to use:

> mp3wrap "Book Title" *.mp3

There are two main downsides to this utility:

  1. All ID3 tags are removed. This isn’t so bad since I manually fixed each book later, but kind of annoying.
  2. _MP3WRAP appended to the file name. There is apparently a way to disable this, but it requires a config file that I couldn’t get working. Renaming files is a simple fix.

Normalizing Folders

I actually did this step while merging the files. All books are now in folders based on their author. Nothing else.

Fixing ID3 Tags

The last step was to fix all the ID3 tags. Before the merge, the tags were wildly inconsistent. After the merging, they were consistent, but wrong. I used MP3Tag to fix each file individually. This was the longest step, but worth it and necessary since Plex isn’t going to be able to match these files to some online source like it does for movies and shows (maybe someday, though).

Here is my basic tag setup:

  • Album - book name
  • Artist - author name
  • Album Artist - author name (this is important for sorting in Plex)
  • Year - release year
  • Artwork - a cover image I pulled from the internet (mostly Wikipedia)
  • Genre - “Audiobook”
  • All other tags - left blank

Plex Library Setup

Once all the files were renamed, merged, and tagged, all that was left was to set up the Plex library. It was as easy as creating any other kind of library in Plex, except this time is was for music. There are two things that made this work perfectly:

  1. I disabled all metadata fetching from the internet. I made sure that Plex would not try to match these files with any online source. It would probably end up wrong, and I had already gone through the effort of tagging them myself.
  2. I had Plex remember playback position. This is why I’m doing all of this. Plex can sync playback position with the server so that I don’t have to remember where I was in a multi-hour long file. There is a setting when creating the library under the Advanced tab labeled “Store Track Progress” that enables this.

Once set up, Plex took a minute to index the files then it was all set. I tried playing one from the web client and it worked. I then picked it up on my phone and it resumed right where I left off. The iOS client even gives me jump back/forward controls (10 and 30 seconds, respectively) which are basically essential.

Conclusion

This is actually usable! Sure, it’s not nearly as easy as Plex’s “name it right and we’ll do the rest” style for movies and shows, but now I have a nice library of audiobooks that I can take with me. Plus Plex syncs my location with the server which means I can listen across devices (or just have more confidence that it won’t lose my position).

The only issues I’ve run into are that because Plex thinks these are music files, it displays square cover art (which most book covers are not). I’ll have to do some more legwork to find square images and replace them, but for now I’ll deal with cropped images. It also doesn’t give any option for listening speed.

But I think the benefits are worth the drawbacks, and who knows, Plex might actually introduce proper support for audiobooks in the future.

I have heard that the remember playback position feature is kind of buggy. I’ll update this post if I run into issues.