安裝方法:1、下載ffmpeg安裝包,使用tar指令進行解壓縮;2、使用make指令編譯安裝ffmpeg;3、3、載ffmpeg-php安裝包,使用tar指令進行解壓縮;4、使用make指令編譯安裝ffmpeg-php即可。
本教學操作環境:Red Hat Enterprise Linux 6.1系統、PHP7.1、Dell G3電腦。
1、安裝ffmpeg
#(1)取得安裝套件
##
wget -c wget http://down1.chinaunix.net/distfiles/ffmpeg-0.4.9-p20051120.tar.bz2
(2)解壓縮
tar -xvf ffmpeg-0.4.9-p20051120.tar.bz2
(3)編譯安裝
./configure --prefix=/usr/local/ffmpeg --enable-shared make make install
(4)測試
# #直接輸入:
ffmpeg
ffmpeg version CVS, build 3277056, Copyright (c) 2000-2004 Fabrice Bellard configuration: --prefix=/usr/local/ffmpeg --enable-shared built on Oct 16 2013 17:05:16, gcc: 4.4.7 20120313 (Red Hat 4.4.7-3) usage: ffmpeg [[infile options] -i infile]... {[outfile options] outfile}... Hyper fast Audio and Video encoder Main options: -L show license -h show help ................................省略
yasm not found, use --disable-yasm for a crippled build的錯誤,需要先編譯安裝yasmyasm下載位址:http://yasm.tortall.net/Download.html
下載原始碼包解壓縮後,編譯安裝./configure make make install
ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory”
解決方法
vi /etc/ld.so.conf
/usr/local/ffmpeg/lib
ldconfig
2、安裝ffmpeg- php
(1)下載安裝套件
wget http://jaist.dl.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.5.3.1/ffmpeg-php-0.5.3.1.tbz2
tar -xvf ffmpeg-php-0.5.3.1.tbz2
#(3)編譯安裝
cd ffmpeg-php-0.5.3.1 ./configure --with-php-config=/usr/local/php/bin/php-config --with-ffmpeg=/usr/local/ffmpeg make make install
(4)測試
在php的配置php.ini文件,加入以下內容extension=ffmpeg.so
/usr/local/php/bin/php -r 'phpinfo();' | grep ffmpeg ffmpeg ffmpeg support (ffmpeg-php) => enabled ffmpeg-php version => 0.5.3.1 ffmpeg-php gd support => enabled ffmpeg.allow_persistent => 0 => 0 ffmpeg.show_warnings => 0 => 0 ............................省略
mv ffmpeg_frame.loT ffmpeg_frame.lo
php: symbol lookup error: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so: undefined symbol: register_ffmpeg_frame_class
vi ffmpeg_frame.c :%s/PIX_FMT_RGBA32/PIX_FMT_RGB32 :wq!
以上是linux怎麼安裝ffmpeg-php擴展的詳細內容。更多資訊請關注PHP中文網其他相關文章!