Take the 2-minute tour ×
Sound Design Stack Exchange is a question and answer site for sound engineers, producers, editors, and enthusiasts. It's 100% free, no registration required.

I am looking for a free tool that would allow me to convert large amounts of FLAC files to ALAC (Apple Lossless Audio Codec) while preserving the meta information and optionally adding new information from CDDB or similar sources.

At this moment I'm more interested in a Windows utility but you are free to recommend OS X ones. Please use different answers for different tools.

share|improve this question
add comment

migrated from avp.stackexchange.com Jan 30 at 4:04

This question came from our site for engineers, producers, editors, and enthusiasts spanning the fields of video, and media creation.

7 Answers

If you're happy using the Terminal, then you could try the following command loop:

for f in *.flac; do ffmpeg -i "$f"  -vf "crop=((in_w/2)*2):((in_h/2)*2)" -c:a alac "${f%.flac}.m4a"; done

This will simply cycle through all the .flac files sitting in the current directory and convert them all to .alac until they're all done. I can confirm that this works in Linux where ffmpeg is freely available in the repositories. For OSX, you can install ffmpeg via homebrew, and there are also static builds for Windows, OSX and Linux listed on the ffmpeg website.

This will preserve the metadata, but the way that M4A stores cover images is fundamentally different from the way that FLAC (and most other audio formats) do it. Unfortunately, FFmpeg is currently unable to handle this. Fortunately, you can extract the cover as a jpeg image on the same step as transcoding the audio, and then use another command-line tool (AtomicParsley) to merge the cover into the M4A.

ffmpeg -i input.flac -vf "crop=((in_w/2)*2):((in_h/2)*2)" -c:a alac output.m4a cover.jpg
AtomicParsley output.m4a --artwork cover.jpg --overWrite

This can similarly be put into a for loop; the &&s mean that the next command will only be performed if the previous command succeeds.

for f in *.flac; do ffmpeg -i "$f" -vf "crop=((in_w/2)*2):((in_h/2)*2)" -c:a alac "${f/%flac/m4a}" "${f/%flac/jpg}" && \
AtomicParsley "${f/%flac/m4a}" --artwork "${f/%flac/jpg}" --overWrite && \
rm "${f/%flac/jpg}"; done
share|improve this answer
1  
The ever-useful ffmpeg. –  Mechanical snail Jul 13 '11 at 23:06
2  
On Windows, do: for %f in (*.flac) do ffmpeg.exe -i "%f" -acodec alac "%~nf.m4a" –  Ilya Oct 20 '12 at 17:43
4  
Can confirm this worked for me (OS X 10.8.2), using brew install ffmpeg. It installed the dependencies texi2html, yasm, x264, faac, lame and xvid. All up it took around 10 minutes to install. –  CaptainCasey Nov 17 '12 at 11:58
add comment

X Lossless Decoder (XLD) is a great prefect lossless ripping and batch conversion tool for the Mac.

I've heard great things about getting perfect lossless rips using Exact Audio Copy (EAC) on Windows, though I'm not sure if it supports conversion.

share|improve this answer
    
Big fan of XLD. I've been using it for years to move Phish concerts in to my iTunes library. –  Ian C. Apr 8 '11 at 16:09
    
Thanks for the tip. XLD is great! –  Mobs Oct 21 '12 at 5:40
add comment

Here's the Windows variant of boehj's answer:

for %f in (*.flac) do ffmpeg.exe -i "%f" -acodec alac "%~nf.m4a"
share|improve this answer
add comment

if you want convert everything flac file in folders and subfolders recursively add the /r to the for loop command like so:

for /r %%a in (".flac") do ffmpeg -i "%%a" -acodec alac "%%a.m4a" -map_metadata input.flac:output.m4a

The only problem i have with this is that filenames come out like

output.flac.m4a

I have no idea how to fix that at the end, but from what I've seen it doesn't HURT the file to be named this way.

EDIT: Replacing the output code with

"%%~na.m4a"

so that the full code looks like

for /r %%a in (".flac") do ffmpeg -i "%%a" -acodec alac "%%~na.m4a" -map_metadata input.flac:output.m4a

WILL make file names look like

output.m4a

BUT will save the converted copies to the ROOT of the folder you have the command run. To clarify flac file is located in

C:\music\foo\bar.flac

alac file will save to

C:\music\bar.m4a
share|improve this answer
add comment

There are a wide range of applications for Windows and for OSX -

you could try Audio Transcoder

or Max

or a range of others (google will find many)

Or you could convert FLAC to WAV and then let iTunes do the rest

share|improve this answer
add comment

I went to the FFmpeg site to download the latest ffmpeg Win32 from 11/20/2012.

You may need 7zip to extract the EXEs and place them in a path that is recognized.

Still can't figure out how to recursively run the command. I've tried using an old DOS command called sweep and also forfiles -s -c but neither work correctly.

I ended up generating a list of flac files including their path using this DOS command:

m:\flac> dir *.flac /b /s > flac_convert.bat

I used the macro feature in NotePad++ (freeware) to change the line

from:

M:\flac\Art Of Noise\Moments In Love.flac

to:

ffmpeg -i "M:\flac\Art Of Noise\Moments In Love.flac" -acodec alac "M:\flac\Art Of Noise\Moments In Love.m4a"

Once I used the macro to change every line, I saved and ran flac_convert.bat

The solution is not elegant, but it does work using only free tools.

share|improve this answer
add comment

XRECODE does a great job of batch conversion. I'm pretty sure it is just a front end for ffmpeg. It keeps your tags and embedded images (for most formats - see this answer for exceptions) during conversion.

The current version has a non-expiring fully functional trial (complete with nag screen), but you can download the previous version for free.

I have not tried the conversion to ALAC, but it does a great job at FLAC, MP3, WMA, and OGG conversion.

share|improve this answer
add comment

Your Answer

 
discard

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