Have you ever converted audio and loaded it on your iPod Nano, Shuffle or other model iPod just to have it clip in your headphones but it plays fine on your computer specifically with AAC codec encodings? I have the fix for you.
I had an OGG file that was 48k sample rate that was only roughly around 128k in bitrate. Given that the older iPods do not support the Opus/OGG format, I was forced to transcode it. I opted to use ffmpeg because it’s the universal standard and my desired format was AAC because it’s more efficient and sounds better at the same bitrate than an MP3. I won’t go into the details of why this is, there are plenty of articles that dive into the differences between MP3 (MPEG-1/2 Layer 3) and AAC (MPEG-4 Part 3).
Originally, I thought it was it was because of the 48,000 sample rate. I leveraged ffmpeg and filter to change the sample rate to 44,100 but this still produced clipping. I had a different issue where I was transcoding a ~130kbps source format and it was being outputted to a ~360kbps. I didn’t catch this at first because of a command line issue but I was led to believe the clipping was occurring because of an extremely high AAC bitrate. This too wasn’t the case.
Ultimately, it has to do with the native AAC encoder with ffmpeg. The fix was to leverage a build of ffmpeg with libfdk_aac.
I was able to use the “nonfree” build of ffmpeg which includes libfdk_aac (Fraunhofer FDK AAC codec) here: https://github.com/nanake/ffmpeg-tinderbox/releases
The Fraunhofer FDK AAC encoder also has a low pass filter on it by default at 14k. This can be bumped up to 20k which is the maximum frequency range of an older generation iPod and research says the maximum frequency response of your hearing (generally accepted).
With the nonfree build of ffmpeg, I wrote a Windows batch loop to convert the OGG files to AAC. Using libfdk_aac fixed the clipping problem when playing transcoded AAC audio on my iPod Nano 3rd Generation.
Hope this helps!
for %a in (*.ogg) do ffmpeg.exe -i "%a" -c:a libfdk_aac -cutoff 20000 -b:a 160k "%~na.m4a"