Fix Quick Look on Audio Files

Quick Look is one of my favorites features on Macs. Since OS X Leopard (10.5), users have been able to preview files directly in the Finder by selecting the file and tapping the spacebar. The preview shows the file without opening the native app.  This lets users quickly glance at Office, PDF, music and video files without waiting for the full app to launch. Icons also get small previews or album artwork to replace the generic logo for the application.

After upgrading to Mountain Lion I noticed all my music files in Finder were missing album art. Only audio files were having issues; PDF, Office docs, and videos were displaying previews. iTunes was displaying the album art, but moving the file to the desktop only showed the generic thumbnail.

Missing album art

Missing album art in finder. Generic thumbnail

At first I thought the album art was not embedded in the file. You can easily re-embed album art by right clicking the art in iTunes, then copying and pasting the art again. This embeds the art directly into the file so it stays with the file if you copy it out of iTunes. Doug’s AppleScripts also has a great tool for batch embedding album art.

I confirmed this feature still worked in Mountain Lion by testing on a friends computer, which meant my system was broken!

To start troubleshooting, I did some research into how Quick Look worked:

OS X uses a plugin architecture for Quick Look. Apple provides a standard set of plugins for video, audio and text files. Software developers can create third party plugins to display items that are not natively supported by Apple. All plugins reside in /System/Library/QuickLook with a ‘.qlgenerator’ extension. At login, the OS loads available plugins to display different types of files. Audio.qlgenerator is the plugin to preview audio files.

To test and manage Quick Look, you can use the terminal command, qlmanage.

The first action was to reload all plugins and clearing the cache.

  • qlmanage -r  (reloads plugins by scanning the QuickLook dir)
  • qlmanage -r cache  (resets the cache for Quick Look. OSX will regenerate thumbnails for all files)

Neither resetting Quick Look or its thumbnail cache did anything to fix my problem. I tried generating the thumbnail through the command line to see if that resolved anything.

  • qlmanage -t -d 1 /users/will/song.m4a (-t parameter will create the thumbnail. -d 1 spits out debug info; debugging level is 1-4. /users/will/song.m4a is the file you want to generate a thumbnail for)

[DEBUG] Thumbnailing file://localhost/Users/will/song.m4a. Content type UTI: com.apple.m4a-audio. Generator used: <QLGenerator Audio.qlgenerator>
[DEBUG] Loading <QLGenerator Audio.qlgenerator>
[DEBUG] Thumbnailing file://localhost/Users/will/song.m4a did not produce anything
* No thumbnail created for /Users/will/song.mp3

In the debug output we can see qlmanage correctly identify the file type, and the appropriate plugin to generate my thumbnail. The system loads ‘Audio.qlgenerator’ and… no thumbnail is created.

What’s going on here? I know the file has embedded artwork, and running the above statement on a PDF or Word doc shows me a preview. This should be working. On top of this, Console.app is showing me any additional debug information.

After some sleuthing on the internet, I stumbled across this thread in the Apple Support forums. User AA101 describes fixing his thumbnail problem by changing where his iTunes media folder is located. My setup is the default for iTunes, so I couldn’t imagine this was an issue for me. However, for kicks, I renamed the iTunes folder so iTunes would create a fresh copy and.. voila! Audio files on my desktop immediately generated thumbnails and let me click play on the icon.

Correctly displaying album art

Icon album art and Quick Look are working after fix.

I did some more testing and narrowed it down to the iTunes database file. Rebuilding the database from the “iTunes Library.xml” will fix the Quick Look issue. This involves trashing the database, restarting iTunes and importing the XML. Apple has instructions here for specific operating systems and iTunes versions.

I was surprised to see such a tight integration with iTunes and Quick Look. These types of issues are tough to narrow down. Quick Look doesn’t require iTunes to be running or for an audio file to reside in the iTunes Library, so checking the database wasn’t an obvious troubleshooting step. If anyone had a different resolution to this problem or insight into this integration, let us know!

Until then, happy Quick Looking!