This is my cyberhome!

October 15, 2010

How to fix gapless analysis problems in iTunes?

Filed under: Apple,Audio,Software — Manish Bansal @ 3:56 pm

The Problem:
If you use iTunes, on windows or mac, it is inevitable that you’d come across this dialog where iTunes says that it’s Determining Gapless Playback Information. It doesn’t matter whether you want your albums to play gapless or not. iTunes just goes ahead and does it. There is no way to turn it off. It would have been pretty harmless, except for one little thing – it often gets stuck and the only way out is to reboot your computer (and lose any unsaved data, not to mention the frustration caused). Though there is no way to turn this process off, there is a way to make it go smooth. The solution is to repair your corrupt MP3 files.

The Reason:
There are plenty of reasons for MP3 files being corrupt but the most common one is bad encoders. All the modern encoders are ok but those present during Napster era (late 90s and early 2000s) were really bad. So if you have any songs encoded during that period, chances are that they are not as per MP3 encoding standards. These songs would play just fine but otherwise cause a lot of problems in terms of tagging and gapless analysis etc. If you do a scan on your collection, you’d be surprised by the number of songs with potential problems. These kind of files are the reason iTunes gets stuck.

The Fix:
The fix is pretty simple, fortunately. All you need is foobar and a bit of time. Don’t worry. The songs will NOT be re-encoded or subject to anything else which might reduce their audio quality. These operations are completely harmless. You can take a backup in case you’d like to be really careful.

Ok, here we go:

  1. Download and install foobar. Make sure that you choose all the utilities and extras during the install.
  2. Launch foobar and go to ‘File -> Preferences -> Shell Integration’. In the right-hand side pane, enable the option ‘Folder context menus’. In the same pane, type ‘*.mp3’ for ‘Restrict incoming files to’. This will make sure that only MP3 files come into foobar as this fix is not applicable for AAC or WAV files etc.
  3. Go to your songs folder in Windows explorer, right-click and choose ‘Enqueue in foobar2000’. Or you and drag your songs folder to foobar.
  4. In foobar, Select all files, right-click and choose ‘Utilities -> Rebuild MP3 Stream’. This will recreate the MP3 file by removing all the non-standard data and other garbage. It will also fix the tags by rewriting them in a standard-compliant way. It took about 3 hours to fix 20k files on my aging PC. A nice side benefit of this fix is that a few more songs will now show up in your iTunes library because of standards-compliant tags.
  5. Once step 4 is over, select all files again, right-click and choose ‘Utilities -> Fix VBR MP3 Header’. This will add the missing VBR header data to the Variable Bit Rate files. The absence of this header causes problems in seeking and also in calculating the duration of song which impacts gapless analysis. This process also took about 3 hours on my somewhat old PC.
  6. This step is optional but I did it anyway. Clean up your iTunes library and add all the songs again. The only thing I care about is song ratings which I store in BPM field so I don’t lose them even if I clean up the iTunes library.
  7. Let iTunes go through ‘Determining Gapless Playback Information’. Typically it won’t get stuck now but there are chances that it still won’t like a few of the songs. The only fix for these songs is to remove them from iTunes library. In my case, I had about 1000 songs in a particular folder which were giving problems. These were the songs which I had converted from FLAC to MP3 a long time back, prehaps using a crappy non-standard encoder. I just removed these songs from iTunes, re-encoded them from FLAC using Lame and everything went fine.

To validate your MP3 files, you can use a free program called MP3val. It can even fix some of the common problems.



  1. Thanks! These tricks and the tool save me after a weekend of frustration.

    Comment by zonedar — March 8, 2011 @ 7:33 pm | Reply

  2. When I select all my songs and right click to choose ‘Utilities -> Rebuild MP3 Stream’ my only option is “Save AS Playlist”.

    I can only get ‘Utilities -> Rebuild MP3 Stream’ if I only have one song selected.

    Am I doing something wrong? I am using Version 1.1.5.

    Comment by Jim Winder — March 26, 2011 @ 5:42 am | Reply

    • That happens when you have songs in other formats also selected in foobar window. See point #2 in the article about restricting the files to only mp3 format.

      Comment by Manish Bansal — March 26, 2011 @ 8:31 am | Reply

  3. When I select all my songs and right click to choose ‘Utilities -> Rebuild MP3 Stream’ my only option is “Save AS Playlist” even after I used point #2 am I doing something wrong?

    Comment by Eduardo Rubalcava — May 7, 2012 @ 3:38 am | Reply

    • Make sure that you install all these MP3 utilities when you install foobar2000. Sometimes there are not installed by default.

      Comment by Manish Bansal — May 7, 2012 @ 10:44 am | Reply

  4. Thanks, these tips save me a lot of time. GREAT!!

    Comment by — July 20, 2012 @ 10:36 pm | Reply

  5. Wow doing this sure does fragment your hard drive. Really, really fragment.

    I wish there were settings in foobar to have it scan and only address the files that need it as opposed to all at once.

    Comment by Simon — August 24, 2012 @ 5:02 am | Reply

  6. iTunes Gapless Playback Problem

    Solution #1 (preferred – results in better sounding music)
    1) download a FLAC version of your broken tracks with BitTorrent from or other BitTorrent trackers.
    2) convert them to Apple Lossless with XLD (preferred) or Max
    3) carefully re-rate the new lossless songs in iTunes.
    4) note which playlists the broken track are in by control-clicking on them and choosing ‘Show in Playlist’.
    5) add the new lossless tracks to the old playlists

    Note: there may be applescripts and other tools to automates some of the above steps.

    Solution #2
    The only solution I found to gapless playback problems was to:
    1) select broken tracks in itunes,
    2) get info on the tracks
    3) in the comments field write “Converted from MP3 320 kbps due to gapless playback analysis.”.
    4) go to the advanced menu and choose ‘Create Apple Lossless Version’.
    5) after the conversion press command-delete to send the broken tracks to the trash.
    6) create a smart playlist from the file menu and choose ‘comments contains’ then type ‘gapless’ in the field.
    7) label the playlist ‘gapless playback problems’

    You waste a few pennies of hard drive space by going to Apple Lossless but audio quality will not be impacted. You also have have a running log in the smart playlist of what tracks you need to upgrade from a compact disc in the future.

    Note: one way to find out which tracks are causing the problem is to slow your computer down to a crawl. e.g. run some java apps, convert some files from FLAC to Apple Lossless in XLD or Max… compile something in Xcode, etc. While the computer is crawling, launch iTunes and gapless playback will take way longer. Menu Meters is a great way to see your CPU power in the menu bar.

    Previously, I tried the following with no luck. On OS X I used Wineskin to run Foobar2000. I added the broken tracks. I selected all tracks. I right clicked using the two fingers on the track pad and clicking the track pad button. Rebuilt the MP3 streams and the VBR headers. Added the tracks to iTunes and I still have the gapless playback problem. An OS X app called MP3 Scan+Repair also did not fix the problem. I lost many hours on this… learn from my trial and error.

    Comment by Black Rock City — October 13, 2012 @ 1:57 am | Reply

    • Thanks for your wonderful comment. I am sure this will help a lot of people solve this annoying problem in iTunes.

      Comment by Manish Bansal — October 14, 2012 @ 10:14 am | Reply

  7. Hey Manish,
    It appears that you are no longer using this blog. I request you, in case you can accommodate, to kindly delete or change the id(in settings) of this blog so as to free the blogspot id. since i share your name it would be an utter delight to get this id 🙂
    kindly, if possible drop me a mail at, if you accept my request.

    Comment by manish — November 21, 2012 @ 11:06 pm | Reply

    • this one is regarding (not the wordpress one)

      Comment by manish — November 21, 2012 @ 11:08 pm | Reply

  8. Just like to share my experience. Just convert to AAC using itunes. Problem solved…

    Comment by Anonymous — December 31, 2013 @ 11:12 am | Reply

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Create a free website or blog at

%d bloggers like this: