如何使用sox将wav文件转换为mp3格式?

时间:2021-01-13 19:41:13

When I run sox directly from the command line as ;

当我直接从命令行运行sox时;

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

sox:'747a.mp3'的输出文件格式未知:文件类型'mp3'未知

My machine is running the CentOS operating system.

我的机器正在运行CentOS操作系统。

4 个解决方案

#1


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

您需要安装合适的MP3编码器,例如LAME,或者使用liblame支持重新编译Sox。

This is independent of your Perl programming :)

这与您的Perl编程无关:)

#2


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:

作为替代方案(如果您只需要将Wave文件编码为MP3),您只需使用LAME即可获得相同的结果,例如:

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

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

LAME可以使用yum无痛地安装在CentOS上。您首先需要RPMForge存储库:

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

#3


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,

对于CentOS,你需要重新编译SOX(基础仓库有sox srpm),安装了libmad和lame-devel库(rpmforge有那些。)一旦完成,sox -h将列出支持的格式。安装mp3库时

sox -t wav -r 8000 -c 1 <wavfilename> -t mp3 <mp3filename>

#4


More info here -

更多信息在这里 -

http://techblog.netwater.com/?p=4

#1


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

您需要安装合适的MP3编码器,例如LAME,或者使用liblame支持重新编译Sox。

This is independent of your Perl programming :)

这与您的Perl编程无关:)

#2


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:

作为替代方案(如果您只需要将Wave文件编码为MP3),您只需使用LAME即可获得相同的结果,例如:

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

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

LAME可以使用yum无痛地安装在CentOS上。您首先需要RPMForge存储库:

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

#3


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,

对于CentOS,你需要重新编译SOX(基础仓库有sox srpm),安装了libmad和lame-devel库(rpmforge有那些。)一旦完成,sox -h将列出支持的格式。安装mp3库时

sox -t wav -r 8000 -c 1 <wavfilename> -t mp3 <mp3filename>

#4


More info here -

更多信息在这里 -

http://techblog.netwater.com/?p=4