Can Apple Lossless audio be converted to FLAC with no loss of fidelity?

19

9

Can Apple Lossless audio files (ALAC) be converted to FLAC audio files with no loss of fidelity?

Kev

Posted 2011-08-29T10:20:00.297

Reputation: 1 922

2short answer 'yes' (as slhck said) . question is, are you looking for a tool to do this with, or asking if you can convert a lossless format, losslessly to another lossless format? – Journeyman Geek – 2011-08-29T15:58:20.873

Answers

37

Yes, given that both are mathematically lossless, conversion is lossless too.

The reason for this is that the signal can always be reconstructed to its original form when a FLAC/ALAC file is decoded. Thus, they are equivalent and you should experience no loss when transcoding — even when transcoding multiple times.

The only error I could imagine would be an arithmetical one, e.g. through limited floating point precision in calculations. I don't think this applies to either FLAC or ALAC.

In case you only use a "psychoacoustically" lossless codec, this is not possible. Lossless in a psychoacoustic sense would mean that you can't distinguish the original and the compressed version, yet they are very different from each other. MP3 or MPEG-4 AAC use various psychoacoustic techniques to achieve this. Thus, when transcoding, the original version can't be reconstructed and you'd experience a loss of quality.


In case you want to convert ALAC to FLAC, ffmpeg would be a good option, as it's free and available for almost every platform.

ffmpeg -i audio.m4a -c:a flac audio.flac

FFmpeg will read ALAC without issues. For *nix systems, there's also a script called Convert to FLAC which makes the whole process easier. With Bash you could simply convert all files in a single directory as well:

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

Note: If you get a message about ffmpeg being deprecated, this is actually not the case – it's still an actively developed program. However, Ubuntu's package maintainers just decided to switch to the Libav fork of FFmpeg and thus supply you with avconv instead of ffmpeg. The version of ffmpeg available on Ubuntu is therefore outdated. You can get a recent one by downloading a static build instead, or compiling it yourself. Read on for more info: Who can tell me the difference and relation between ffmpeg, libav, and avconv

slhck

Posted 2011-08-29T10:20:00.297

Reputation: 182 472

XLD is another good one for OSX. – Arran Cudbard-Bell – 2016-06-20T23:00:58.940

2

Based on http://superuser.com/a/277358/45914, you can do the following to convert an entire directory:

for f in *.m4a; do ffmpeg -i "$f" -acodec flac "${f%.m4a}.flac"; done

This works on Linux, but also in a Git bash on Windows, for example.

– Ruud – 2012-03-08T13:12:19.523

1Converting using ffmpeg, as @RuudvA said, works but gives me a message that says: *** THIS PROGRAM IS DEPRECATED *** This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.

In order to do this using aconv, do this instead:

for f in *.m4a; do avconv -i "$f" "${f%.m4a}.flac"; done – Duncan Lock – 2013-05-08T03:09:03.707

3

For Windows CMD you can do.

@for /R %%x in (*.m4a) do ffmpeg -i "%%x" -acodec flac "%%~dpnx.flac"

(Batch Script)

( This will do Recursion ( Every Folder and under from where its run ))

The009

Posted 2011-08-29T10:20:00.297

Reputation: 31

1

for Windows in Powershell (using ffmpeg) you can do this to convert alac to flac:

Get-ChildItem . -filter *.m4a| ForEach-Object { ffmpeg -i "$_" -acodec flac "$($_.basename).flac" }

and conversely do this to convert to alac

Get-ChildItem . -filter *.flac | ForEach-Object { ffmpeg -i "$_" -acodec alac $($_.basename).m4a" }

BoteRock

Posted 2011-08-29T10:20:00.297

Reputation: 111

1

If you have a Mac (since you have ALAC files), you could also use the open source software Max as nice frontend to do the conversion from and to ALAC/FLAC or many other formats..

Alex

Posted 2011-08-29T10:20:00.297

Reputation: 19

2Another nice one is XLD. – Nathaniel – 2013-03-27T17:03:02.180