I'm currently building a script to maintain parallel music libraries, because I have devices that can't play FLAC, but prefer to store my music in that format. However, I'm having some trouble with the part that converts FLAC to ALAC. It currently just dispatches FFMPEG to do the job. However, FFMPEG (version 0.5.9) can't seem to preserve the tags! -map_meta_data infile:outfile doesn't work... neither does -map_meta_data outfile:infile, -map_meta_data 0:0, or -map_meta_data 0:0,s0 (or something like that), all of which I'd seen people suggest.

So... I'm now looking for a command-line program (or a Python library) that can convert FLAC to ALAC on Linux, while preserving the tag data. It'd even be acceptable if I have to copy the tags after converting - but I can't find a solution for that either. I've tried QLCLI, but it seems to fail when importing Quod Libet. I'm trying to make this all work under Ubuntu. Any suggestions?

  • 1
    Can you try a more recent version of FFmpeg? You can compile it from source as documented on the homepage – slhck Sep 3 '12 at 19:09
  • 1
    In Ubuntu 12.04 LTS, it looks like the provided version of ffmpeg does preserve the tags. I just tried ffmpeg -i "in.flac" -acodec alac "out.m4a" and all the tags seem to have been converted. – mivk Oct 4 '12 at 0:02

The current ffmpeg (version 2.0.2 as I write this) supports both decoding and encoding for ALAC. And it copies global metadata from the first input file by default.

Invoking it like this:

ffmpeg -i track01.flac -c:a alac track01.m4a

produced an ALAC file with the metadata copied.


If source audio file has an embedded cover art, ffmpeg will convert that into a video, which is probably not what you want. Complete command is:

ffmpeg -i file.flac -vn -acodec alac file.m4a

And in batch mode:

ls *flac | while read f; do
    ffmpeg -i "$f" -acodec alac -vn "${f[@]/%flac/m4a}" < /dev/null;

The -vn switch will make ffmpeg ignore "video" parts of source file. Tags will be transferred to destination file, but I'd prefer to use Picard tagger to retag the new files using a robust artist/work/release database as MusicBrainz.

Here are more advanced techniques:


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.