How to Convert WAV to MP3 in Linux
I've been recording some audio tracks as uncompressed WAV files, but they are too large for sending over the internet or storing on mobile devices. Here’s how to convert WAV to MP3 which will compress the audio and make them more usable.
Adverts Blocked This website is supported entirely by advertisements. Please disable AdBlocking software so that I can continue providing free content and services.
As with photo compression, there are two types of audio media file formats - "lossy" and "lossless." Among most popular lossless formats stands WAV (Waveform Audio File Format), while MP3 is the most common lossy format.
Lossy files are called so because they lose some data after compression to make its size smaller. WAV file is a completely uncompressed media file and takes up quite a bit of space.
ALAC and FLAC are both lossless formats of audio files that contain the same data as a WAV, but they use compression to produce smaller files. FLAC and ALAC formats don’t lose any data - they keep all of it and compress it brilliantly, as ZIP files do. ALAC and FLAC player support is much less than MP3 so you may have difficulty finding something that will play these files, and they are not supported on iPod and iPhone.
How to Compress WAV to MP3 on the Command Line
These commands do not alter the original, which you can back up to CD-ROM or similar, instead they write out a new file which is typically 70-80% smaller than the original.
You can install ffmpeg using this command:
sudo apt-get install ffmpeg
Update: Some of the newer distros do not have this package so you may need to add the repository if the above command does not work.
sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next sudo apt-get update sudo apt-get install ffmpeg
The commands to Convert WAV to MP3 in Linux using ffmpeg is:
ffmpeg -i track01.wav -acodec mp3 track01.mp3
You can also specify the bitrate of the MP3 with the -ab flag.
ffmpeg -i track01.wav -acodec mp3 -ab 64k track01.mp3
That is all you need to do to convert WAV to MP3 in the Linux shell. You can also specify wildcards to process multiple files at the same time.
Last updated on: Saturday 11th August 2018