Today I tried to play some Spotify files I had downloaded using youtube’s downloader, but could not get them to import or play.
- You can play some m4a files, but not others.
- Quicktime will allow you to open the m4a file, but it’s longer than it should be and there is no sound
- Windows Media Player and VLC can both play the file
Make sure you have Quicktime installed before concluding this is your problem.
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.
You can remux the file to add the seek table using ffmpeg. Instructions for Windows below:
- Download ffmpeg from http://ffmpeg.zeranoe.com/builds/
- If you don’t know which one you need download the 32 bit static version
- Extract the zip file anywhere you want
- Navigate to the zip file and run ff-prompt.bat
- 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.