Phil Gyford

Writing

Sunday 8 December 2002

PreviousIndexNext Encoding with LAME in iTunes

Last time I did this I didn’t write this down anywhere so I’ve had to find all the pages again. Next time it’ll all be right here. It’s possible to encode MP3s using the LAME encoder directly from iTunes without too much hassle…

LAME is apparently the best MP3 encoder or, at least, the best free one. The encoder that’s built into iTunes isn’t as good. But you can install LAME and encode your MP3s using it direct from iTunes.

[UPDATE: I think you can replace the three steps below with the improved version of the script from step three, iTunes-LAME encoder (see discussion at VersionTracker). It says it installs LAME for you, and doesn’t mention needing the developer tools. If you can confirm this, post in the comments below, as it would make life a lot simpler! (27 July 2003)]

  1. You’ll need to install the Mac OS X developer tools to install LAME, as it requires some behind-the-scenes software installed with the tools. I think the tools come on a CD with OS X, but you can join Apple’s Developer Community and download them.
  2. Download the Mac OS X LAME installer from Vas the Man’s Downloads and install it. [1 May 2003: Or you could download LAME and install it from the command line.]
  3. Download the Convert to MP3 [LAME] AppleScript and, as the Read Me tells you, put the script into your ~/Library/iTunes/Scripts/ directory. There’s some early discussion of this script here.
  4. Now, just encode your CDs as normal, but instead of choosing “Convert Selection to MP3” from the Advanced menu in iTunes, use the LAME option under the AppleScript menu. You can enter some options for the encoder in the dialog box, so you could either spend a while reading the instructions that came with the encoder or just enter --r3mix which is apparently the best quality/size balance. [Update: Or maybe not; see Nick’s comment below.]

To be honest, I don’t notice the difference between this and a fairly standard 128kbps encoding, but I have cloth ears, and like to think I’m doing things the best way. Maybe someday I’ll have a hifi that makes the differences all too noticeable, and I wouldn’t want to have to encode everything again.

Comments

--r3mix is a little dated now, Phil. The preferred presets for more recent versions of LAME are --alt-preset-[foobar] and seem to work a bit better than r3mix. I use --alt-preset-standard, anyway, which is a good compromise between file size, quality and encoding time...

Posted by Nick on 8 December 2002, 6:18 pm | Link

Darn it. Thanks Nick. Where do you keep up with this kind of thing? There I was thinking I'd got to grips with something, only to find out I'm at least one step behind.

Posted by Phil Gyford on 9 December 2002, 10:53 am | Link

One place to keep up with such things is the forums at Hydrogen Audio, http://www.hydrogenaudio.org/

Posted by Greg on 13 May 2003, 5:54 pm | Link

For some one like my-self with little or no experiance. Your above directions were a "no-brainer". Thanks.

The results were way better than you let on. I chose a test song. OMD's "The Avenue" off OMD "Navigation The OMD B-Sides"

Lame took 1:20 sec. to encode. iTunes with AAC took about :55 seconds.

However the Lame version sounded much fuller, crisper and louder.

Lame aint lame at all!

Once again thanks for the tip.

Posted by Greg Hargis on 13 May 2003, 11:07 pm | Link

I installed just as you said. The quality difference is quite noticeable. I tried it on Dark Side of the Moon and it clips off the end of the song. This makes an abrupt change when there should a smooth transition edit between songs. Is this a bug or do you need to set a parameter to get rid of this?

Posted by Mark Hebert on 18 May 2003, 1:06 am | Link

Eating Crow and Track Numbers
I opened my big mouth and I have to eat crow. You are right Phil, iTunes chops of the last bit of song too. It can extract joined tracks at rip time in iTunes but I don't know if LAME can do that too. Files sure sound superior than the ones made with iTunes.

Also, I loose the track number using LAME within iTunes. I read on Hydrogenaudio that Track Number - Tack Name is a setting. How do I use that when ripping from within iTunes? Is this true?

Posted by Mark Hebert on 27 May 2003, 2:35 am | Link

Mark Hebert: that's a problem with mp3 in general in my experience. They don't stitch seamlessly together. However in iTunes, if you choose "crossfade playback" & set it to 0 seconds, it does a pretty good job of stitching them together.

Posted by Peter Jaques on 27 May 2003, 8:08 am | Link

File Names in Track Order
I looked into the Track Number - Tack Name perameters and it is only for ID3 tags, not renaming the files 01filename.mp3, 02filename.mp3, etc. in album track order. Do I have to manually do this? LAMEBrain does this for me but I want to use LAME within iTunes. Is there a parameter I can use in LAME to do this?

Posted by Mark Hebert on 28 May 2003, 2:58 am | Link

I've never needed this... I have iTunes set to organise the mp3 library for me. When I run the LAME AppleScript it adds the encoded songs to iTunes (as well as putting a folder of them on my Desktop, which I delete). iTunes puts the mp3s in its library, titling them "01 songname.mp3" etc.

Posted by Phil Gyford on 28 May 2003, 10:19 am | Link

I've added an update about how to use the very latest version of LAME with iTunes-LAME Encoder: http://www.gyford.com/phil/writing/2004/09/23/encoding_with_th.php

Posted by Phil Gyford on 23 September 2004, 12:14 am | Link

I've finally updated LAME/libsndfile on my web site. The new version of libsndfile icludes better utilities, as well.

Posted by Vas the Man on 30 January 2005, 9:53 pm | Link

Can I use LAME on a PC? If so, will following these steps work, or is this for mac only?

Posted by casey on 27 December 2006, 5:17 am | Link

Casey - I know nothing about Windows and I assume these instructions will only work on a Mac, sorry.

Posted by Phil Gyford on 27 December 2006, 9:43 am | Link

Commenting is disabled on posts once they’re 30 days old.

Some sites linking to this entry (Trackbacks)

Monday morning links
Post-caffeine hit links: Yoz Grahame has put together a great reading list on game AI, distributed projects and nerdcore, a
At 'ext|circ' on Monday 9 December 2002, 9:02 AM