Andrey Krisanov

LLM inference, AI infrastructure, and distributed systems

Convert FLAC to Apple Lossless with FFmpeg

Convert FLAC to Apple Lossless (ALAC) with FFmpeg while preserving audio quality and metadata, then import the files into Apple Music.

2 min read
#ffmpeg #apple-music #audio #flac #alac

I use Apple Music for most of my music collection. I also buy rare or remastered CD releases that are sometimes distributed as FLAC files, which Apple Music does not support. I convert them to Apple Lossless Audio Codec (ALAC) before importing them into my library.

Install FFmpeg with Homebrew:

brew install ffmpeg

Install FFmpeg with Homebrew

Open the directory containing the FLAC files and run:

for file in *.flac; do
  ffmpeg -i "$file" -acodec alac -vcodec copy "$(basename "$file" .flac).m4a"
done

mkdir flac alac

for file in *.flac; do
  mv "$file" flac/
done

for file in *.m4a; do
  mv "$file" alac/
done

Convert FLAC files to ALAC and organize the output

FLAC files for Susumu Hirasawa's album Siren in Finder
Susumu Hirasawa – Siren [Limited Edition]

The script converts each FLAC file to ALAC in an .m4a container. It moves the source files to flac and the converted files to alac:

Converted M4A files in the ALAC directory in Finder
Converted ALAC files in Finder

Drag the alac directory into Apple Music to import the album and upload its tracks to the cloud.

The imported Siren album in Apple Music
The uploaded album