Monday, December 19, 2005

Quick tips on how to install MP3 compression into media player

Once upon a time I actually made the mistake of paying for a licensed MP3 compressor for Microsoft Media Player. Of course, despite backing up my keys and other licensing encumberments, after I resinstalled windows it was no longer possible to reinstall my MP3 compressor.

Back then LAME had terrible performance and was encumbered by problems of its own, not least a general lack of an ACM driver that worked. Now, things are different. It's easy to get access to a high quality, completely free MP3 encoder for Windows Media Player.

I now use LAME to perform my MP3 compression when extracting my CDs to MP3 to play in the car and so on. However, I don't use Media Player much, as Plextools has offered cddb support for a while now, and there's no longer any benefit to using Media Player.

However, I recently had to install some extraction and compression software for someone who was determined not to have a Plextor CD or DVD drive. In fact, they had decided to use a drive that had just about the most crippled ASPI support I've seen. The latest version of Nero was able to work with it, but almost everything else was unable to discover it, despite various ASPI shennanigans.

Media Player was able to operate the drive, and has the ability to retrieve CD artist/title information, so I suggested it as a CD ripper. Of course, MP3 compression was required, and it took me an age to track down information on how to install the ACM support for LAME - and eventually had to grub through my registry to find it. The data is out there on the net, and even saved on my computer, but it's hard to find amongst all the google noise. To make it a little easier I'm putting that info up here: it's one more chance for people to find a link that's not junk.

It's just a registry hack

First you need to install LAME and the LAME ACM codec. I compile my own, but there's no need, you can download it precompiled from the free-codecs site. This site used to have a bit of a reputation for distributing spyware and trojans, but from my experience it seems ok now. Look at the left side-bar under Audio Codecs. You want the LAME MP3 Encoder. This package includes everything you need, including the ACM codec interface. Let me know if you try to use this link and it turns out to be stale.

Once you've downloaded the package, you need to unzip and install it. The latest version have a .inf file as part of the package, which you can double click to install the codec. There is also installation advice on the free-codecs site.

Now all you have to do is add a few entries to the registry. The easiest way to do this is to cut and paste the following text into your favourite text editor, save it as a .reg file and then double click the file to install the changes. Alternatively, you can type the entries direct into regedit. It's up to you.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MediaPlayer\Settings\MP3Encoding]
"LowRate"=dword:0001f400
"MediumRate"=dword:0002ee00
"MediumHighRate"=dword:0003e800
"HighRate"=dword:0004e200
"PreferredCodecName"="LAME MP3"
"PreferredCodecPath"="C:\\WINDOWS\\system32\\l3codecp.acm"
"HighRateSample"=dword:0000a028
"LowRateSample"=dword:0000a028
"MediumRateSample"=dword:0000a028
"MediumHighRateSample"=dword:0000a028

You will need to edit the value for PreferredCodecPath after you've cut and paste the text into your .reg file. This needs to refer to wherever you have installed your LAMP MP3 ACM file (the .acm file). This is usually system32 within your WINDOWS or WINNT directory, but this might vary depending on your install. I believe the latest version is called LameACM.acm rather than l3codecp.acm, so for most people the path is going to be "C:\\WINDOWS\\system32\\LameACM.acm"

You can tweak the available data rates which match to the four qualities available in Media Player. Make sure you edit them in decimal and not hex if you are using regedit directly.

Some people have suggested that you should use the Fraunhoffer codec and a playback rate of 48KHz. This is pointless as the CD source material is only 41KHz to begin with, and LAME supports 41KHz playback just fine. Also, LAME is freeware and Fraunhoffer is not. Why run some dodgy warez'd compressor when you don't need to?

If it's all working properly, then when you go into Media Player's Options, select the Rip Music tab. There's a pull down to choose the format of the compressed data. You should now be able to select LAME MP3 instead of some variety of WMA.

Personally, I prefer VBR compression for my MP3s, as it works fine with all my hardware based players, and with WinAmp etc. It's better quality in the same space, but Media Player's interface doesn't support it directly. As Media Player gets involved with writing out the MP3 header, it probably wouldn't help if you hacked the ACM to make the compressor output VBR data. This isn't a problem with Plextools, which supports LAME specifically and is VBR aware. You can also compress OggVorbis with Plextools, but it's still hard to find hardware players that support it - which is a great pity.

For the same reasons that you are unlikely to be able to write a VBR MP3 from Media Player, you can't use a trick to make it compress OggVorbis or Monkey's either. It's a pity that Microsoft didn't provide a more general interface within Media Player so that we could compress in the formats we want to use and not just the ones they want us to use. Again, this problem is solved by Plextools, and no doubt many other ripping packages too.

1 Comments:

At 11:43 pm, Blogger Term Papers said...

I really admire this, I mean it really looks interesting! Very nice research. Thanks to the author.

 

Post a Comment

<< Home