I have about 300 gigs of ALAC files (m4a container) with well groomed metadata, album art, etc. (Original source: CD rips with dbPowerAmp). I want to convert my music library to 128kbps AAC (still m4a) to save on hard drive space on a small server.

The solution I'm hoping for is a command line based option using ffmpeg or the like. There's nothing Mac-specific about doing it that way but given it's all Apple codecs and I'm doing the conversion on a Mountain Lion box I thought I'd ask here. I can manage most of the shell scripting myself but I don't know ffmpeg well enough to be sure that it retains metadata and album art.

I've done a conversion in the past with iTunes 10; there's a trick where you manipulate "Convert higher bit rate songs to 128 kbps AAC". But the conversion quality is not sufficient. iTunes rewrites filenames in various circumstances, particularly when any non-ASCII is involved. Also it takes more than 20 hours to do the conversion and there's no clean way in iTunes to keep track of what's converted if the batch is interrupted.

  • Not CLI but it might do the job: XLD
    – bot47
    Commented Jan 18, 2013 at 13:48

3 Answers 3


I realise this is not a command line solution, but I use Max to convert FLAC and ALAC to AAC and MP3 files, and it keeps the metadata intact.


Its a very lightweight app.

There are also download links and instructions on the site for how to build the app from the source, so maybe the moving parts of the ALAC-to-AAC with metadata conversion could be discerned from there.

Also, before compressing lossless rips to save space, maybe give TuneSpan a try, and put your lossless audio on external storage?


  • Any tips on using Max on 300 gigs of source input? It seems to work completely on my sample file; album art carries over, mp4info from mp4v2 shows all the metadata tags are preserved.
    – Nelson
    Commented Jan 18, 2013 at 17:44
  • I've never batch processed more than a handful of FLAC rips (~5GB) at once. So as far as pausing or keeping track of converted files, I don't have any advice. Although, there are options to automatically add tracks to a specific iTunes playlist once they've been converted, which may help some. If you do decide to go that route, I would recommend using the instructions in this forum post to prevent iTunes importer from throwing errors while importing the files: forums.sbooth.org/…
    – ian.pvd
    Commented Jan 18, 2013 at 17:57
  • Thanks. I should add I've verified Max doesn't break on non-ASCII tags and filenames. It is renaming the output files (and adding a disc number) but I can live with that.
    – Nelson
    Commented Jan 18, 2013 at 18:08
  • There is a panel for customising output file names: grab.by/j8b0 Though, this will set a pattern for all converted files, which wont solve your problem if the naming conventions vary.
    – ian.pvd
    Commented Jan 18, 2013 at 18:37
  • I've finished a full conversion and it seems to have gone well. Max will transcode in parallel so it's significantly faster than iTunes; converted 300 gigs in 3.5 hours and avoided the whole pause/restart problem.
    – Nelson
    Commented Jan 18, 2013 at 22:10

This seems to preserve most common tags but not cover art (edited to add -vn):

ffmpeg -i alac.m4a -vn -acodec libfaac -aq 110 aac.m4a

-aq 110 is about 130 kb/s for normal music files. -aq 400 would be about 270 kb/s.

If you have 4 cores, this runs up to 4 parallel processes:

find . -name \*.m4a | parallel ffmpeg -i {} -vn -acodec libfaac -aq 110 {.}-aac.m4a
  • 1
    Thanks, this is helpful. I had to add the -vn flag to ffmpeg to get it to ignore the album art; it was identifying a Stream #0:1: Video: mjpeg, yuvj420p, 250x243 in the input file and then failing to convert with height not divisible by 2 (250x243) Using mp4info from mp4v2 I see that most of my metadata carried over, but not the Disk: 1 of 1 or Track: 1 of 10 fields from my original. And then there's the album art. Can ffmpeg handle m4a album art at all? Is there some other tool I could use instead to post-process the converted audio?
    – Nelson
    Commented Jan 18, 2013 at 17:32

AtomicParsley can remove/add album art from command line


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .