This article expresses the author's opinion at the time of writing. There are no guarantees of correctness, originality or current relevance. Copying the whole article is forbidden. Transcription of selected parts is allowed provided that author and this source are mentioned.
Recently, I noted that some MP3 files ceased to play in iTunes. I suppose that this problem began with iTunes 12, but I am not entirely sure about that. Fact is, I have iTunes 126.96.36.199 and the songs wouldn't play.
These MP3s still played on my iPhone and on my iPods, and they are copied to these devices as long as they already were in the iTunes library. But, if they were removed from iTunes, they could not be re-added, since iTunes did not recognize these files as valid MP3.
It rang a bell somewhere that all affected songs seemed to be very old items of my library — probably converted from CDs to MP3 around 1999-2001, using LAME. It was a time that I possessed a huge CD collection and I had begun to convert it to MP3. I was a Linux zealot then, and employed the just-released LAME encoder. Songs encoded by slightly more recent versions of LAME (2002 and onwards) were not affected at all.
I found a number of problematic MP3 files by hand, and then tried to discover if they had anything in common. After some research, I found that bad songs had the following characteristics:
At least in OS X, almost all characteristics are revealed by the file command-line tool. The emphasis can be checked out by the exiftool tool (quite a surprise since EXIF data is more readily associated with the JPEG format).
Moreover, I found that all problematic files are also CBR (not LAME VBR with 160kbps in average). VBR files have no problems, even though VBR did have issues with some MP3 players back in 1999/2000.
Many broken MP3 songs belonged to CDs that were fully encoded in a single batch. Yet, only 25%-50% of each batch was affected. For some reason, LAME assigned the CCIT J.17 emphasis to some, but not all, songs.
With this information in hand, it was trivial to put together a script that found the bad songs and reencoded them using mpg123 and lame. Yes, I still use LAME, even on OS X :) Both tools can be found in Brew, Rudix, or any other OS X ports collection of your choice. The exiftool package can be found in its own website.
One problem I found is that ID3 tags were not copied to the fresh MP3. I guess I could have used id3lib to extract and reimplant the tags. Since less than 100 songs were affected, and iTunes retained the metadata in its own library even after the MP3 file is replaced, it was easier to right-click "Get Info" in each file, change something and force a rewrite of ID3 tags onto the MP3 file, so it shows when copied to some non-Apple device.
Another popular alternative to "fix" unplayable MP3 files is to open them in Quicktime and export them as AAC. I suppose that this technique keeps the metadata across files.