How do I convert an MP3 file to WAV format under Linux using a shell prompt?
There are plenty of tools that to convert an MP3 file into WAV format. I recommend mpg321 which is a free command-line mp3 player, which uses the mad audio decoding library.
Install mpg321 or mpg123
Type the following command under Debian / Ubuntu Linux, enter:
sudo apt-get install mpg321
OR
sudo apt-get install mpg123
I recommend using mpg123 as it is updated frequently.
Install mpg123 under CentOS / RHEL / Fedora Linux
Turn on rpmforge repo and type the following command:
yum install mpg123
Convert an MP3 to WAV
The -w option will convert an .mp3 file to .wav file. The syntax is:
mpg123 -w output.wav input.mp3
OR
mpg321 -w output.wav input.mp3
A Sample Shell Script Helper Function
Add the following to your ~/.bashrc startup file (tested with bash v3.x+):
mp3towav(){ [[ $# -eq 0 ]] && { echo "mp3wav mp3file"; exit 1; } for i in "$@" do # create .wav file name local out="${i%/*}.wav" [[ -f "$i" ]] && { echo -n "Processing ${i}..."; mpg123 -w "${out}" "$i" &>/dev/null && echo "done." || echo "failed."; } done }
Use it as follows:
mp3towav *.mp3 mp3towav "this is a test.mp3" ls *.wav
Featured Articles:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 11/3/09



{ 9 comments… read them below or add one }
Sorry, I meant:
ffmpeg -i input.mp3 output.wav@Metalx1000, nice, I’ve deleted your old post and kept only correct one.
Hi,
Is there any tool/command in Fedora to convert mp4 files to avi ?
Or above command will also work for mp4 file.
Thanks,
Sanjay
Command line tools:
Gui tools:
is there a tool tool to convert .wmv/wma to mp3/mp4 or any other format which totem can easily play?
Another gui tool SoundConverter
Thanks man.
I appreciate.
Thanks Vivek Gite.
@gemuet
ffmpeg -i input.wmv output.mp4That will convert the wmv to mp4 with default settings, which may not be the best quality.
For more option on converting to mp4 with ffmpeg check out this post:
http://www.modmymoto.com/forums/showthread.php?t=304281
I appreciate your help man.