DEV Community

Andrey Krisanov
Andrey Krisanov

Posted on • Originally published at akrisanov.com on

Convert Flac to Apple Lossless With FFmpeg

I'm a longtime Apple Music user. Most of my so-called music collection is on the streaming service. However, I occasionally buy rare or remastered releases ripped from CDs. These releases are usually in the FLAC format, which Apple Music doesn't support. But I've found an easy workaround that allows me to organize and play albums on the go.

The centerpiece of the workaround is FFmpeg. So if you don't already have it installed, it's worth installing now:

brew install ffmpeg
Enter fullscreen mode Exit fullscreen mode

Homebrew Formula

When the tool is ready to use, navigate to the folder containing the FLAC files and run the following script:

for file in *.flac; do ffmpeg -i "$file" -acodec alac -vcodec copy "`basename "$file" .flac`.m4a"; done; mkdir flac; mkdir alac; for file in *.flac; do mv "$file" "flac/"; done; for file in *.m4a; do mv "$file" "alac/"; done;
Enter fullscreen mode Exit fullscreen mode

Silly One-liner Converting FLAC to ALAC


Susumu Hirasawa – Siren [Limited Edition]

The bash script converts the audio to the Apple Lossless format (*.m4a) and moves the files to the alac directory:

Finally, the alac directory can be dragged to Apple Music to import the album and upload its tracks to the cloud.


The Uploaded Album


πŸ‘‰ You probably wonder why this album has no Lossless icon in Apple Music. Well, it turns out the audio quality of the FLAC files wasn't on pair with lossless. So, make sure releases you buy or rip, have a proper audio codec and quality.

Top comments (0)