How do I convert a wav file to mp3 format using sox?

centos, mp3, sox, wav

Solution

As an alternative (if all you need is to encode a Wave file to MP3) you can just use LAME to achieve the same results, for example:

lame -b 32 --resample 8 -a <wavefilename> <mp3filename>

LAME can be installed on CentOS painlessly using yum. You'll first need the RPMForge repository:

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Then:

yum install lame

Problem

When I run sox directly from the command line as ; ``` sox -r 8000 -c 1 <wavfilename> <mp3filename> ``` I get the following error message: sox: Unknown output file format for '747a.mp3': File type 'mp3' is not known My machine is running the CentOS operating system.

Original source