服務(wù)器環(huán)境介紹
阿里云 Centos 7.2
安裝Speex 解碼器
https://github.com/ppninja/wechat-speex-declib
可直接對(duì)微信下載下來的文件轉(zhuǎn)wav
yum install speex-devel
git clone https://github.com/ppninja/wechat-speex-declib
make
軟鏈接至可執(zhí)行目錄
ln -s /root/wechat-speex-declib/bin/speex_decode /usr/local/bin/speex_decode
安裝ffmpeg
FFMpeg官方下載地址:
http://ffmpeg.org/download.html
下載 ffmpeg倒得、yasm、lame 的最新版本
下載下來的是一個(gè) tar.xz 或 tar.bz2 文件
可以直接使用 tar xvJf *.tar.xz 來解壓
先安裝lame吼过、yasm泼诱,進(jìn)入相應(yīng)目錄坛掠,解壓文件:
tar xvJf ***.tar.xz
./configure
make
make install
編譯安裝lame、yasm之后進(jìn)行安裝ffmpeg
進(jìn)入ffmpeg目錄
./configure --enable-libmp3lame
make && make install
編譯ffmpeg需要較長時(shí)間治筒,耐心等候屉栓。
完成后嘗試轉(zhuǎn)換時(shí)在我的服務(wù)器上出現(xiàn)問題:
# ffmpeg -i test.wav test.mp3
ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory
軟鏈接一下:
ln -s /usr/local/lib/libmp3lame.so.0.0.0 /usr/lib64/libmp3lame.so.0
解決。
開始轉(zhuǎn)換
speex_decode xxx.speex xxx.wav
ffmepg -i xxx.wav xxx.mp3
成功耸袜!