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

54,247

Solution 1

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

Solution 2

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 :)

Share:
54,247
Admin
Author by

Admin

Updated on July 09, 2022

Comments

  • Admin
    Admin almost 2 years

    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.

  • Scott
    Scott over 13 years
    Guess one needs to figure out how to do that....
  • Scott
    Scott over 13 years
    I read the article. What does one do if they already have the older version? I installed it using the dag repositories.... I'm new to linux.
  • Morgan
    Morgan over 9 years
    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.
  • dotancohen
    dotancohen about 8 years
    Dead link. Dead link.