Converting FLAC to ALAC losslessly
FLAC stands for Free Lossless Audio Codec, and like the name implies, it is lossless; the original recording of sounds (usually music in practice) is preserved. Thus, it can be used to playback very high quality music.
But on some media library managers, such as iTunes, FLAC is unsupported. We can re-encode FLAC to ALAC, a supported codec, while still preservering the lossless quality. First, install ffmpeg
:
sudo apt install ffmpeg
Then, we just need to tell ffmpeg
the desired encoding and appropriate filenames. The -acodec
option lets us do so:
ffmpeg -i input.flac -acodec alac output.m4a
That’s all.
We can gain some confidence that the conversion was lossless. Use ffprobe
to check the sampling rate and bitrate:
ffprobe input.flac
and compare it against
ffprobe output.m4a
If you can see that they both use 44100 Hz
sampling rate and output.m4a
’s bitrate is greater than or equal to input.flac
’s bitrate (e.g. 547 kb/s
> 520 kb/s
), then we probably didn’t lose any information through the re-encoding.