作者:只是遇不到他_740 | 来源:互联网 | 2023-06-28 13:10
微信语音是amr格式,如需mp3格式需要自行转换,
转换方式可以用sox或用ffmpeg,这里我们使用ffmpeg
首先安装系统编译环境
yum install -y automake autoconf libtool gcc gcc-c++
编译所需源码包
yasm:汇编器
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make install
lame
wget http://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar -xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure
make install
amr支持
wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz
tar -xzvf opencore-amr-0.1.3.tar.gz
cd opencore-amr-0.1.3
./configure
make install
amrnb支持
wget http://www.penguin.cz/~utx/ftp/amr/amrnb-11.0.0.0.tar.bz2
tar -xjvf amrnb-11.0.0.0.tar.bz2
cd amrnb-11.0.0.0
./configure
make install
amrwb支持
wget http://www.penguin.cz/~utx/ftp/amr/amrwb-11.0.0.0.tar.bz2
tar -xjvf amrwb-11.0.0.0.tar.bz2
cd amrwb-11.0.0.0
./configure
make install
ffmpeg
wget http://ffmpeg.org/releases/ffmpeg-2.5.3.tar.bz2
tar -xjvf ffmpeg-2.5.3.tar.bz2
cd ffmpeg-2.5.3
./configure --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-shared
make install
编译安装完成后在/etc/ld.so.conf文件末尾加上:/usr/local/lib 然后执行
ldconfig
var file ="xxx/xxx/xxx.amr";
var newFile = file.Replace(Path.GetExtension(file), ".mp3");
var processStartInfo= new ProcessStartInfo("ffmpeg", $" -i {file} {newFilePath}");
using (var process= Process.Start(processStartInfo))
process?.Close();
}
文章来源于https://www.cnblogs.com/zhangliang2008/p/13177021.html