Spotify Does Not Play .m4a Files

Today I tried to play some Spotify files I had downloaded using youtube’s downloader, but could not get them to import or play.

Symptoms

  1. You can play some m4a files, but not others.
  2. Quicktime will allow you to open the m4a file, but it’s longer than it should be and there is no sound
  3. Windows Media Player and VLC can both play the file

Make sure you have Quicktime installed before concluding this is your problem.

Explanation

Spotify leverages Quicktime to play .m4a files. Unfortunately, Quicktime uses a library called libfaad to decode M4A/AAC files. This library contains a bug, which does not allow it to play MP4A dash files. This includes any file which was downloaded with youtube’s youtube-dl library (as was my case). Specifically, Youtube’s MP4 container has an empty “time-to-sample” (AKA the seek table) atom, which causes the problem.

Thanks to here for some of the explanation.

Fix Action

You can remux the file to add the seek table using ffmpeg. Instructions for Windows below:

  1. Download ffmpeg from http://ffmpeg.zeranoe.com/builds/
  2. If you don’t know which one you need download the 32 bit static version
  3. Extract the zip file anywhere you want
  4. Navigate to the zip file and run ff-prompt.bat
  5. Use the following command “ffmpeg -i <YOUR_FILE>.m4a -acodec copy -movflags faststart <NEW_NAME>.m4a”

where YOUR_FILE must be a fully specified path such as C:\Users\whoever\music\YOUR_FILE.m4a and NEW_NAME must also be a fully specified path such as C:\Users\whoever\music\NEW_NAME.m4a

This will place the file in a new container which includes the seek table. The file should now be playable and you can import it into Spotify.

Grant

Leave a Reply