21

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.

innaM
  • 47,505
  • 4
  • 67
  • 87

3 Answers3

12

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
Juan
  • 1,428
  • 2
  • 22
  • 30
  • Thank you so much. I tried to get sox working for forever and a half, but this just worked out of the box with no hassle. Saved me probably hours of trying to figure out why no one else's solutions worked for me. – Morgan Mar 23 '15 at 23:18
10

You'll need to install an appropriate MP3 encoder, e.g. LAME, or recompile Sox with liblame support.

This is independent of your Perl programming :)

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
Jeremy Smyth
  • 23,270
  • 2
  • 52
  • 65
5

For CentOS you will need to recompile SOX (the base repo has the sox srpm) with the libmad and lame-devel libraries installed (rpmforge has those.) Once that is done, sox -h will list supported formats. When mp3 libraries are installed,

sox -t wav -r 8000 -c 1 <wavfilename> -t mp3 <mp3filename>
slm
  • 15,396
  • 12
  • 109
  • 124
  • 3
    Hints for enabling RpmForge (to install libmad-devel and lame-devel): http://wiki.centos.org/AdditionalResources/Repositories/RPMForge You'll also need alsa-lib-devel and libvorbis-devel And some info about SRPM: http://wiki.centos.org/HowTos/RebuildSRPM – Oleksandr Yanovets Dec 18 '09 at 12:09
  • 1
    Is CentOS always a pain in the rear? – Scott Jan 04 '11 at 03:12
  • @SashaYanovets Thanks thanks thanks! that fixed the "Sox was compiled without mp3 encoding support" thank you again – Moisés Olmedo May 11 '13 at 16:10