Converting Audiobooks for older iPods

A collection of FFMPEG scripts which can be used to convert a drm-free m4b audiobook, into one that will actually sync and play on your old iPod
5 min read

Recently, similar to the topic of my last post on my chrome extension, I’ve been trying to reduce digital distraction and be more intentional about media I consume. Part of this, is using an old iPod classic with my music library, and audiobooks. That way, I can take my iPod and brainstorm without connection to the internet while keeping my music or books.

In the past, I’ve bought books on the Apple Books store. This comes with two problems. First - they have DRM. Which I’m never a fan of. The second problem - is these DRM’ed files sometimes refuse to play on my iPod.

This post contains some scripts I run on the drm-free m4b files when they don’t work, in order to re-add any missing cover art, as well as encode to the older encoding profile the iPods like to play.

DRM, Oh DRM.

If the DRM encoded books don’t work, they can’t be fixed. Since they’re encrypted, it’s not possible to split them, or re-encode them with a tool like ffmpeg. Thus, I’d recommend using a site like Libro.fm (referral link) to buy DRM free books, instead of using a service like Apple or Audible. They have a subscription which gives you pretty decent discounts on otherwise relatively expensive books. Sometimes, they’ll also offer a registration bonus of a few extra books.

Sometimes, the .m4b files you download from Libro.fm (just like with Apple Books), don’t play on the iPod, and when you try to sync them, it fails - citing “incompatibility”, or “cannot be copied because the file could not be converted”. Rubbish.

cannot be converted

Prerequisites

You’ll need ffmpeg, and familiarity with the terminal. If you’re on macOS - I recommend using Homebrew, which once you install it makes installing ffmpeg as easy as brew install ffmpeg. On linux, ffmpeg is usually in your distro’s package manager.

The commands I’m providing you’ll need to run in the terminal - so if you aren’t comfortable doing so, I’d recommend asking a tech-savvy friend to help you get started.

Also note in these commands - I’ll rename the original file to have the suffix _original for clarity, as well as that the name is used by the iPod, so I want it to be the correct book title.

Existing Art

This is a more simplified version, existing art and chapters. A pure optimization pass, downsizing the image and ensuring the audio is encoded so it can play. Run this in your terminal, but first edit the filenames so they’re correct in the command below.

I also include a video filter to downsize and re encode the thumbnail, just in case it’s too large, it may cause problems. Here, I cap it at 600x600px.

Note: for b:a - I set the max bitrate at 96k for better quality, but you can set this at 64k if you wish to optimize for space. Also this might show a weird bitrate as ffmpeg treats it as a video, but it works so my copy of Thunderball (which previously won’t sync to my iPod), now syncs and plays normally.

ffmpeg \
  -i Thunderball_original.m4b \
  -map 0:a -map 0:v \
  -b:a 96k \
  -aac_pns 0 \
  -ar 44100 \
  -map_metadata 0 \
  -movflags +faststart \
  -disposition:a 0 \
  -disposition:v attached_pic \
  -vf "scale='if(gt(iw,600),600,iw)':'if(gt(ih,600),600,ih)':force_original_aspect_ratio=decrease" \
  -c:v mjpeg \
  -c:a aac_at \
  Thunderball.m4b

Adding in Cover Art

On principle, I always try to maintain metadata, cover art, etc., whenever possible, to enhance my experience in interacting with books and music. This, is the command I used to fix my copy of 1984 to run on my iPod and add in book art that was missing from my Libro.fm download.

My copy of 1984 didn’t come with the book thumbnail, so I saved that as 1984.jpg, and added it in:

ffmpeg \
  -i 1984_original.m4b \
  -i 1984.jpg \
  -map 0:a -map 1:v \
  -b:a 96k \
  -aac_pns 0 \
  -map_metadata 0 \
  -ar 44100 \
  -movflags +faststart \
  -disposition:a 0 \
  -c:a aac_at \
  -vf "scale='if(gt(iw,600),600,iw)':'if(gt(ih,600),600,ih)':force_original_aspect_ratio=decrease" \
  -c:v mjpeg \
  -disposition:v attached_pic \
  1984.m4b

Arguments Explained:

  • -i 1984_orig.m4b - the original m4b we downloaded that won’t play
  • -i 1984.jpg - cover art
  • -map 0:a -map 1:v - map the streams
  • -b:a 64k - lock bitrate to 64k - you may be able to increases this to 96k
  • -aac_pns 0 - this feature doesn’t work on iPods
  • -map_metadata 0 - use metadata from input #0 (the book)
  • -ar 44100 - Lock sample rate to 44.1khz
  • -movflags +faststart - set as faststart for better seeking
  • -disposition:a 0 - remove any disposition flags set on original audio
  • -c:a aac_at - this uses apple’s aac encoder
  • -vf "scale='if(gt(iw,600),600,iw)':'if(gt(ih,600),600,ih)':force_original_aspect_ratio=decrease" - filter to ensure art is max 600x600px (gpt-ism)
  • -c:v mjpeg - since resizing, need to encode as jpg
  • -disposition:v attached_pic - (video stream here, as an attached image)
  • `1984_v2.m4b

Feedback

Found a typo or technical problem? report an issue!

Subscribe to my Newsletter

Like this post? Subscribe to get notified for future posts like this.