Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm wondering if anyone has a clean, painless workflow for losslessly transcoding FLAC files to their equivalent ALAC? It's supposed to be a bit-perfect conversion, meaning it shouldn't be very hard, but.... it is.

Why would I do this? (Before the OS folks eat me alive) Mainly, because an audio app that I use (Serato Scratch Live) does not support FLAC, and despite the constant prodding of users over the last five(!) years, most likely will not for a while. They did, however, hack together ALAC support

Also, it would seem that getting iTunes to play FLAC files (and properly downconvert them to use space efficiently on my iPod) is pretty much impossible.

The only catch is that I'd like to preserve some weird, offbeat meta tags (BPM and song key) that would be a bit painful to regenerate. I'm down with anything on Windows or Linux

Thanks

Tom

share|improve this question
up vote 8 down vote accepted

In Ubuntu you can open a terminal, navigate to the directory in question, and do the following command loop:

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

This will convert all the .flac files in that directory to .alac files and it will do so in a 'bit perfect' way.

ffmpeg doesn't come packaged with Ubuntu so you'd need to install that from the repos.

I can't say for sure, however, that this will keep your BPM tag info.

Also, it would seem that getting iTunes to play FLAC files (and properly downconvert them to use space efficiently on my iPod) is pretty much impossible.

There's a program called flukeformac that may allow you to play .flac files in iTunes.

As to conversion for efficient iPod use, the following command loop will do the trick:

for file in *.flac; do $(flac -cd "$file" | lame --preset fast extreme - "${file%.flac}.mp3"); done

Here you may want to replace the --preset fast extreme option to another, lower bitrate option. More on lame presets can be found here.

share|improve this answer
    
An excellent, comprehensive answer. Thank you – Tom Corelis Aug 4 '11 at 5:10

dBpoweramp can convert Flac to Alac

http://www.dbpoweramp.com/dmc.htm

After installing, get the needed codecs here http://www.dbpoweramp.com/codec-central.htm

.

share|improve this answer

FFmpeg should be able to do it; it's up to you to find the correct commands to do so.

share|improve this answer

I'm using Free and easy method using just FooBar and iTunesEncode for it's converter.

first you need to get iTunesEncode

then just go to FooBar , select all in your flac playlist -> right click -> convert

Look to the right side -> Formats -> Click it -> Select Custom

And customize it this way :

Encode Tool : path to iTunesEncode.exe
Extension : m4a 
Parameters : -d -e "Lossless Encoder" -a "%artist%" -l "%album%" -t "%title%" -g "%genre%" -y %date% -n %tracknumber% -i %s -o %d
Format is: lossless
next propery : 24

DisplayInfo example :
"Encoder name" - iTunes
"Bitrate" - 1000
"Setting" - Apple Lossless

That's it, fill other parameters to convert -> save configuration (optional)

And press Convert.

share|improve this answer

Based on boehj answer, just for Windows using PowerShell and ffmpeg:

ls -recurse -include *.flac | %{C:\path_to_ffmpeg\ffmpeg.exe -i $_.FullName -acodec alac ($_.DirectoryName+"\\"+$_.BaseName+'.m4a')}
share|improve this answer

MediaMonkey can do this as well, but it'll only preserve BPM tag (I'm not aware of Song Key being a standardized tag across these formats).

note: you'll need to purchase the 'MediaMonkey Codec Pack' for ALAC encoding.

share|improve this answer

To the (Windows) command-line addicts out there:

I've written an automation script for iTunes for Windows that batch imports all FLAC files from the given folder and its subfolders into iTunes in ALAC format, preserving the key metainformation such as album, artist and song name. It requires flac.exe and metaflac.exe and a small helper utility for charset conversion. You can download a ready-to-use package that includes those dependencies (see below) or fork my project on GitHub.

For the full story, binary download, limitations, etc., refer to my blog post.

share|improve this answer

In Windows you can open a command prompt, navigate to the directory in question, and run the following commands to convert the FLAC files to ALAC in the same directory on a different drive (the way I prefer to have it) using qaac, libFLAC and iTunes:

  1. copy all your folders to the destination directory, including the album front cover files with the file names (folder.(jpg|png|gif)):

    robocopy "s:\music" "d:\music" folder.jpg folder.png folder.gif /E

    The option /E includes the empty directories, if you don't want them copied use the /S option.

  2. use qaac to convert all the FLAC files in that directory to ALAC files on the other drive in a 'bit perfect' way and keeping most of the original metadata:

    FOR /R %I IN (*.flac) DO qaac64 -A --copy-artwork -o "d:%~pI%~nI.m4a" "%I"

Please note that

  • the directory names on the source (s:) and destination (d:) drive need to be the same (otherwise you need to tinker with the variables in the FOR command, qaac won't create the directories for you)
  • you need to change into the source directory (s:\music in the above example) for the commands to work
  • the destination directory (d:\music in the above example) should be empty to avoid overwriting files
  • you can use the SUBST command to map a directory to a drive letter if you want to create the ALAC files on the same drive
  • you'll have to run at least version 2.57 of qaac and use the appropriate binary for your windows version (32bit or 64bit)
  • qaac needs to be in your Windows PATH variable or you'll have to include the full path to its binary in the FOR command above
  • qaac needs iTunes or QuickTime installed to work
  • qaac needs a matching copy of the libFLAC DLL in its directory to read FLAC files, you can find it on the rarewares site

Painless and gratis.

share|improve this answer
    
Welcome to Super User! Thanks for posting such a comprehensive first answer. :) – Excellll Jan 20 at 22:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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