Convert FLAC to ALAC M4A Using FFmpeg

This guide provides a straightforward, step-by-step tutorial on how to transcode lossless FLAC audio files into the Apple Lossless Audio Codec (ALAC) format inside an M4A container using FFmpeg. You will learn the exact commands required for converting single files, batch processing entire folders, and ensuring your metadata remains intact.

The Basic Conversion Command

To convert a single FLAC file to ALAC M4A, open your terminal or command prompt and run the following command:

ffmpeg -i input.flac -c:a alac output.m4a

Command Breakdown: * -i input.flac: Specifies the path to your source FLAC file. * -c:a alac: Tells FFmpeg to use the Apple Lossless Audio Codec (ALAC) for the audio stream. * output.m4a: Defines the name and container of the output file. Using the .m4a extension is required for ALAC compatibility with Apple devices.

Batch Converting Multiple Files

If you have an entire album or folder of FLAC files, you can automate the process using a simple command-line loop.

On Windows (Command Prompt):

Navigate to the folder containing your FLAC files and run:

for %i in (*.flac) do ffmpeg -i "%i" -c:a alac "%~ni.m4a"

On macOS and Linux (Terminal):

Navigate to your directory and run this Bash loop:

for f in *.flac; do ffmpeg -i "$f" -c:a alac "${f%.flac}.m4a"; done

Metadata and Cover Art Preservation

By default, FFmpeg will automatically copy existing metadata tags (such as Artist, Album, Title, and Track Number) from the FLAC file to the output M4A file.

If your FLAC files contain embedded cover art, FFmpeg will also copy the artwork. If you encounter issues where the cover art is dropped or improperly handled, you can explicitly tell FFmpeg to treat the video/image stream as attached pictures by running:

ffmpeg -i input.flac -c:a alac -c:v copy output.m4a

Using this command ensures that your lossless transition from FLAC to ALAC is seamless, preserving both audio fidelity and library organization.