一拟烫、 安裝系統(tǒng)編譯環(huán)境
yum install -y automake autoconf libtool gcc gcc-c++
二、編譯所需源碼包
1迄本、匯編器硕淑,新版本的ffmpeg增加了匯編代碼
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
make install
2、Mp3音頻解碼
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
make install
3嘉赎、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
make install
4置媳、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
make install
5、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
make install
6公条、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
make install
三拇囊、命令行使用方法
ffmpeg -i 1.mp3 -ac 1 -ar 8000 1.amr #MP3轉(zhuǎn)換AMR
ffmpeg -i 1.amr 1.mp3 #AMR轉(zhuǎn)換MP3
四、PHP調(diào)用CentOS命令調(diào)用ffmpeg將amr格式轉(zhuǎn)mp3
1靶橱、配置php執(zhí)行exec寥袭,打開(kāi)php.ini修改“disable_functions”,找到它后把“exec” 去掉关霸,然后保存文件传黄,重啟服務(wù)器。(safe_mode_exec_dir修改命令要調(diào)用的程序队寇,如:safe_mode_exec_dir = "/usr/local/bin"膘掰。)
2、exec函數(shù)執(zhí)行
$amr="/路徑";
$mp3 ="/路徑";
$command = "/usr/local/bin/ffmpeg -i {$amr} {$mp3}";
exec($command,$error);