How to convert WAV files to MP3 with the command line using LAME like a boss in Windows 10

How to convert WAV files to MP3 with the command line using LAME like a boss in Windows 10

After researching for the best and most optimal tools to convert files in different formats, for WAV files, the LAME project ended up being my favorite solution to convert WAV files to MP3 easily and without losing so much quality, unlike other tools.

What is LAME

LAME is a high-quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL. Today, LAME is considered the best MP3 encoder at mid-high bitrates and at VBR, mostly thanks to the dedicated work of its developers and the open-source licensing model that allowed the project to tap into engineering resources from all around the world. Both quality and speed improvements are still happening, probably making LAME the only MP3 encoder still being actively developed.

1. Download LAME binary for Windows

The first thing you gotta do is to obtain the LAME binary so we can start encoding the WAV files. As usual with open source, is normal to compile projects from the source code, however as we are in Windows, someone already did it for us. For the LAME project, you can find the latest versions of the LAME encoder on this website.

The packages that you can find on the mentioned website (Packages of LAME), the highest quality MP3 encoder contain:

  • lame.exe - the command line encoder, the one we will use in the Windows command shell.
  • lame_enc.dll - LAME encoding library, generally used with CD rippers, etc.

In my case, I downloaded LAME 3.100.1, compiled on 2020-09-08 with an Intel 19 Compiler. win32 compile should work on XP, or later. This a point release with NO changes to the encoding library. The internal mpglib decoding library has been replaced with the libmpg123 decoding library. I will extract the content of LAME on my desktop (C:\Users\sdkca\Desktop\lame).

2. Testing the executable

Open a new command prompt and switch to the directory where you placed the content of LAME. In my case, it was the desktop:

cd C:\Users\sdkca\Desktop\lame

In the folder, you will find the executable of lame (lame.exe). You can type the following command to get some help about the commands and the way to use LAME:

lame.exe --help

It will output something like:

LAME 64bits version 3.100.1 (

usage: lame.exe [options] <infile> [outfile]

    <infile> and/or <outfile> can be "-", which means stdin/stdout.

    lame -V2 input.wav output.mp3

    -b bitrate      set the bitrate, default 128 kbps
    -h              higher quality, but a little slower.
    -f              fast mode (lower quality)
    -V n            quality setting for VBR.  default n=4
                    0=high quality,bigger files. 9.999=smaller files
    --preset type   type must be "medium", "standard", "extreme", "insane",
                    or a value for an average desired bitrate and depending
                    on the value specified, appropriate quality settings will
                    be used.
                    "--preset help" gives more info on these

    --priority type  sets the process priority
                     0,1 = Low priority
                     2   = normal priority
                     3,4 = High priority

    --help id3      ID3 tagging related options

    --longhelp      full list of options

    --license       print License information

Encoding options

The mp3 encoding standard allows you to choose a number of encoding parameters. One obvious choice is between mono and stereo sound, where we can also in many cases gain efficiency by encoding the average and difference of left and right channels separately.
More important is the choice of the bitrate, that is the compression ratio. The higher the compression ratio the larger the role of the psychoacoustic model. Only certain bitrates are allowed according to ISO 11172:

  • 32 kbit/s single_channel only
  • 40 kbit/s mp3 only
  • 48 kbit/s single_channel only
  • 56 kbit/s single_channel only
  • 64 kbit/s
  • 80 kbit/s single_channel only
  • 96 kbit/s
  • 112 kbit/s
  • 128 kbit/s
  • 160 kbit/s
  • 192 kbit/s
  • 224 kbit/s not single_channel
  • 256 kbit/s not single_channel
  • 288 kbit/s mp1 only
  • 320 kbit/s not single_channel
  • 352 kbit/s mp1 only
  • 384 kbit/s mp2 only, not single_channel
  • 416 kbit/s mp1 only
  • 448 kbit/s mp1 only

LAME supports the stereo mode for low bitrates also.

3. Converting a WAV to MP3

There are multiple ways to convert a WAV to MP3 using this tool, it all depends as well on how many resources you want to assign to the task as well as the output quality of the audio (and size of the mp3). The most simple one is to convert it directly with a custom bitrate that you can specify with the -b flag, you can pick a custom bitrate from the previous list, in our case we will use a rate of 128 kbit/s:

lame -b 128 "C:\Users\sdkca\Desktop\input-file.wav" "C:\Users\sdkca\Desktop\output-file.mp3"

With a WAV file of 43MB and 3:51 of length, the result MP3 is a 3.7MB audio file. Alternatively, you can use one of the presets of LAME:

To activate these presets:

   For VBR modes (generally highest quality):

     --preset medium      This preset should provide near transparency to most
                          people on most music.

     --preset standard    This preset should generally be transparent to most
                          people on most music and is already quite high
                          in quality.

     --preset extreme     If you have extremely good hearing and similar
                          equipment, this preset will generally provide
                          slightly higher quality than the "standard" mode.

   For CBR 320kbps (highest quality possible from the --preset switches):

     --preset insane      This preset will usually be overkill for most people
                          and most situations, but if you must have the
                          absolute highest quality with no regard to filesize,
                          this is the way to go.

   For ABR modes (high quality per given bitrate but not as high as VBR):

     --preset <kbps>      Using this preset will usually give you good quality
                          at a specified bitrate. Depending on the bitrate
                          entered, this preset will determine the optimal
                          settings for that particular situation. For example:
                          "--preset 185" activates this preset and uses 185
                          as an average kbps.

   "cbr"  - If you use the ABR mode (read above) with a significant
            bitrate such as 80, 96, 112, 128, 160, 192, 224, 256, 320,
            you can use the "cbr" option to force CBR mode encoding
            instead of the standard abr mode. ABR does provide higher
            quality but CBR may be useful in situations such as when
            streaming an mp3 over the internet may be important.

    For example:

    --preset standard <input file> <output file>
 or --preset cbr 192 <input file> <output file>
 or --preset 172 <input file> <output file>
 or --preset extreme <input file> <output file>

A few aliases are also available for ABR mode:
phone => 16kbps/mono        phon+/lw/mw-eu/sw => 24kbps/mono
mw-us => 40kbps/mono        voice => 56kbps/mono
fm/radio/tape => 112kbps    hifi => 160kbps
cd => 192kbps               studio => 256kbps

For example, if you want to convert a WAV to a CD-quality MP3, the following command should do the trick:

lame --preset cbr 192 "C:\Users\sdkca\Desktop\input-file.wav" "C:\Users\sdkca\Desktop\output-file.mp3"

Which creates a 5.4MB file for our example WAV file (higher quality).

Happy coding ❤️!

This could interest you

Become a more social person