Skip to content

Using mp3lame with MPlayer/mencoder

After too many minutes hunting for a solution to the vexing issue of why mencoder, part of the excellent MPlayer movie player, wouldn’t convert a WMV file to MP3, I’ve decided to ‘give back to the community’ that has given so much (that being the open source software community). Well, here’s my solution. Your mileage may vary.

Download the latest MPlayer sources via Subversion:

svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer

Download the LAME sources from http://lame.sourceforge.net/download.php

Untar the LAME sources into the newly created MPlayer trunk directory (the directory is not ‘mplayer’ as stated in the README)

You will see a directory called lame-398-2 (or whatever is the latest version).

Within this directory is the libmp3lame directory. Copy that into the MPlayer trunk directory:

cp -R /home/you/trunk/lame-398-3/libmp3lame .

Where . is the trunk directory, if you are in it. Note the lack of a trailing slash on libmp3lame! You want the directory name copied and its files, not just the files themselves.

./configure –help to see available options. I like to make sure that /usr/local/lib/codecs exists first (if not, create it), and run ./configure –codecsdir=/usr/local/lib/codecs –enable-mp3lame, then run make && make install.

On my system (Slackware64-current), notice the result of

bash-3.1$ mencoder -oac help
MEncoder r29789-4.3.3 (C) 2000-2009 MPlayer Team

Available codecs:
copy – frame copy, without re-encoding (useful for AC3)
pcm – uncompressed PCM audio
lavc – FFmpeg audio encoder (MP2, AC3, …)

Where’s mp3lame? What gives?

Aha, notice where mencoder was installed, /usr/local/bin (look at the results of ‘make install’).

Now, notice the difference in output:

bash-3.1$ /usr/local/bin/mencoder -oac help
MEncoder SVN-r30479-4.4.3 (C) 2000-2010 MPlayer Team

Available codecs:
copy – frame copy, without re-encoding (useful for AC3)
pcm – uncompressed PCM audio
mp3lame – cbr/abr/vbr MP3 using libmp3lame
lavc – FFmpeg audio encoder (MP2, AC3, …)
twolame – Twolame MP2 audio encoder
faac – FAAC AAC audio encoder

Okay, but why doesn’t using the absolute path work? Because a link was automatically created to the default installation of /usr/bin/mencoder, which we don’t want.

Thus,

bash-3.1$ rm /usr/bin/mplayer; rm /usr/bin/mencoder; rm /usr/bin/gmplayer

Then, reconfigure as above and ‘make install’. Now, if your PATH doesn’t contain /usr/local/bin, you won’t be able to use mencoder alone, you’ll have to use the absolute path of /usr/local/bin/mencoder.

Trying this,

bash-3.1$ /usr/local/bin/mencoder audioFileName.wmv -oac mp3lame -ovc frameno -of rawaudio -o audioFileName.mp3

equals success at last, at least for me. I now have MP3 audio output of a video file for iPod use. As the video was but a lecture anyway… hence, this long trail. Now, you may say, but why not just listen to the lecture; why bother? For one, I’m not certain that an iPod/iTunes can play WMV files. But, I didn’t investigate — after all, the play’s the thing.

Post a Comment

You must be logged in to post a comment.