Covert .mp3 to .wav and .ogg from command

Jack Wallen
Feb 5, 2010
Updated • Dec 4, 2012
Music, Music and Video

I have a ton of various music files on my machine that are in various states of migrating from .mp3 to different formats. The primary reason for this is because of the issue of licensing between Linux and the MP3 format. And although there are GUI tools to do nearly every job you need, there are times when the command line is still your friend. For instance, say you want to do batch jobs - the command line is good for this. Or say you want to (for whatever reason) secure shell into a remote machine and then convert your files. For whatever reason you need, it's good to know that the tools are available for the job.

The tools I am talking about are mpg123 and mpg321. Although mpg321 claims to be a drop-in replacement for mpg123, I still prefer to use both tools (the former for converting .mp3 to .wav and the latter for converting .mp3 to .ogg). And in this article you will see how simple it is (using the command line) to convert these file types.


Since we will be using the command line for the conversion, we'll install the tools from the command line. The distribution I am using for example is based on the recent, stable Debian. You will not need to add any repositories to your /etc/apt/sources.list file, because all of the tools are found on the standard repositories. To install these tools, follow these steps:

  1. Open up a terminal window.
  2. If needed, su to root (if you use sudo in place of root, just add sudo to the beginning of the installation commands below).
  3. Issue the command apt-get install mpg123 mpg321 vorbis-tools

That's it. Now let's take a look at how the tools are used.

Convert .mp3 to .wav

The first conversion is to .wav. Why use .wav? First and foremost, the .wav file is not compressed and is lossless, so the sound is better. The only downfall is that the files are much bigger. So, if you have a particular file and you want to retain as much quality as you can, .wav is the format to use. Of course, in this instance we are converting a lossy file type (.mp3) so there is already diminished sound quality. But why diminish it further? To make this conversion, the command looks like this:

mpg123 -w output_file.wav input_file.mp3

Where output_file is the name of the .wav file that will be converted from the mp3 file named input_file. So let's say you want to convert the file Rush_Tom_Sawyer.mp3 to .wav. That command would look like:

mpg123 -w Rush_Tom_Sawyer.wav Rush_Tom_Sawyer.mp3

Convert .mp3 to .ogg

The .ogg format is the open source equivalent to .mp3 and is supported by many players. The .ogg format is a good format to use when creating "mix cd's" (I'm old, I still want to say "mix tapes"), because you can fit more files per CD than if you were using the .wav format. But to convert the .mp3 to .ogg the command looks like:

mpg321 Input_File.mp3 -w raw && oggenc raw -o Output_file.ogg

Let's examine the same file we converted to .wav above. The command to convert to .ogg from .mp3 would look like:

mpg321 Rush_Tom_Sawyer.mp3 -w raw && oggenc raw -o Rush_Tom_Sawyer.ogg

Easy right?

Final thoughts

Now you can get crafty and create batch scripts that will allow you to do batch conversions. Naturally many will think "Why would I go through that, when I can just download a handy GUI tool like Soundconverter to do the job? Why? Because it's always smart to have the command line option around. One day you might need it.


Tutorials & Tips

Previous Post: «
Next Post: «


  1. Justin said on November 30, 2011 at 10:18 am

    The warning message about AAC streams when you load streams is because you don’t have the free Orban AAC/aacPlus Player Plugin installed.

    1. Martin Brinkmann said on November 30, 2011 at 10:56 am

      Justin, thanks for the information.

  2. santosh said on December 1, 2011 at 12:43 am

    does this support AAC ? or only mp3 streaming

    1. Martin Brinkmann said on December 1, 2011 at 1:43 am

      I’d say it supports all pls streams but I have not tried that so cannot verify it 100%.

  3. Barnabas said on August 3, 2012 at 5:15 pm

    Thank you Martin for a most informative and viable solution (it allowed me to play streams from a Netherland internet radio station in my WMP)! Continued success to you!

    Barnabas (USA)

  4. AppleRome said on October 7, 2012 at 7:31 am

    Your steps’ recommendation is still valid until 7th October 2012.. Thank you very much !!

  5. Laura said on December 1, 2012 at 4:41 pm

    Thank you!

  6. sak2005 said on December 9, 2014 at 8:03 pm

    You must convert file.pls to file.m3u
    because file.pls open with winamp and file.m3u open with wmp.

  7. Lithium said on February 10, 2017 at 11:10 am

    2017 still kicking on Windows 7
    Thx a ton

  8. Dennis said on April 18, 2017 at 4:05 am

    Hey, even i can do it, i stumbled through it and it works great! The only instruction advice i will add as i had to figure this out, when the wmp box opens that says save or open the bar on right says wmp click that drop down and select “open pls in wmp” once you do that it will work . Took me quite some time to discover that as i am no computer expert by any means. Having said that, previously i had downloaded codec packages and something about aac. None did any good. This rocks, i listen to a lot of internet radio and a number of them have dropped flash player and getting wmp to work had been a nightmare. So many thanks for this great solution to another problem that Micro-Hell will not even address. Peace- Out

  9. stephen marshall said on March 19, 2019 at 2:07 am

    openplsinwmp came in a zip file. I unpacked it, and didn’t find anything that looks like an executable, and even the files in the “doc” folder were in a format windows didn’t recognize. I’m not stupid. you said it would open effortlessly. It didn’t. This a rabbit hole I don’t want to go down.

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.