Ubuntu – Converting FLAC to ALAC, preserving tags – in a script

conversionflacmusic-managementpythonUbuntu

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?

Best Answer

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.

Related Question