FFMPEG 和 FFMPEG-PHP 的安裝

來源:互聯網
上載者:User
 

FFMPEG 和 FFMPEG-PHP 的安裝
軟體:

FFmpeg 官方首頁: http://ffmpeg.sourceforge.net
cvs -z9 -d:pserver:anonymous@mplayerhq.hu:/cvsroot/ffmpeg co ffmpeg

FFmpeg-php 官方首頁 http://ffmpeg-php.sourceforge.net
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ffmpeg-php login
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ffmpeg-php co ffmpeg-php

Lame
http://www.linuxpackages.net/sea ... ;name=lame&ver=

Apache v2.0.54 官方首頁: http://www.apache.org
http://www.apache.org/dist/httpd/httpd-2.0.54.tar.gz

PHP v4.3.11 官方首頁: http://www.php.net
http://cn.php.net/distributions/php-5.0.4.tar.gz

GD Library v2.0.33 官方首頁: http://www.boutell.com/gd/
http://www.boutell.com/gd/http/gd-2.0.33.tar.gz

FreeType v2.1.10 官方首頁: http://www.freetype.org
http://savannah.nongnu.org/downl ... etype-2.1.10.tar.gz

Jpeg v6b 官方首頁: http://www.ijg.org
http://www.ijg.org/files/jpegsrc.v6b.tar.gz

LibPNG v1.2.8 官方首頁: http://sourceforge.net/project/showfiles.php?group_id=5624
http://voxel.dl.sourceforge.net/ ... 1.2.8-config.tar.gz

zlib v1.2.2 官方首頁: http://www.gzip.org/zlib/
http://www.zlib.net/zlib-1.2.2.tar.gz

開始安裝:

1、解壓縮,把所有源碼壓縮包放在一個目錄中,解壓縮所有 .tar.gz 和 .tar.bz2壓縮包
for i in `ls *.gz`;do tar zxvf $i; done;
for i in `ls *.bz2`;do tar jxvf $i; done;

2、安裝
##### lame #####

lame-CVS20050706-i686-1jto.tgz解壓後
複製lame中./usr/include ./usr/bin ./usr/lib 三個檔案夾到伺服器對應地方

##### ffmpeg #####

cd ffmpeg

./configure --prefix=/usr/local --enable-memalign-hack --enable-mp3lame --enable-shared
make
make install

cd..

cp -r /usr/local/lib/libav*.so /usr/lib

註:
--prefix=/usr/local不得修改,否則ffmpeg-php安裝不上
運行/usr/local/bin/ffmpeg –v測試是否安裝成功

##### Apache2 #####

cd httpd-2.0.54

./configure --enable-so --prefix=/server/httpd --with-config-file-path=/server/httpd/conf
make
make install

cd ..

註:
運行/server/httpd/bin/httpd –k start http://192.168.1.xxx測試是否安裝成功
測試完後要關閉/server/httpd/bin/httpd –k stop

##### FreeType #####

cd freetype-2.1.10

./configure --prefix=/usr/local/freetype
make
make install

cd ..

##### LibPNG #####

cd libpng-1.2.8

./configure --prefix=/usr/local/libpng --enable-shared --enable-static
make test
make install

cd ..

##### Jpeg #####

cd jpeg-6b

mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/bin
mkdir /usr/local/jpeg/lib
mkdir /usr/local/jpeg/include
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man/man1

./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
make
make install

cd ..

##### zlib #####

cd zlib-1.2.2

./configure
make
make install

cd ..

##### GD Library #####

cd gd-2.0.33

./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg --with-freetype=/usr/local/freetype --with-png --with-zlib

make
make install

cd ..

##### ffmpeg-php #####
按照官方的說法,可以在裝php前安裝ffmpeg-php
但是我沒成功
運行不了phpize
因此此步在裝了php後再進行
有點傻

##### PHP #####

cd php-4.3.11

./configure --prefix=/server/php --with-apxs2=/server/httpd/bin/apxs --with-gd=/usr/local/gd --enable-gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local/jpeg --with-png --with-ttf --with-zlib --with-freetype-dir=/usr/local/freetype --with-config-file-path=/server/httpd/conf
make
make install

cp php.ini-dist /server/httpd/conf/php.ini

cd ..

##### ffmpeg-php #####
mv ffmpeg-php /path/to/php_sources/ext/ffmpeg
cd /path/to/php_sources
autoconf
./configure --prefix=/server/php --with-apxs2=/server/httpd/bin/apxs --with-gd=/usr/local/gd --enable-gd --enable-gd-native-ttf --with-jpeg-dir=/usr/local/jpeg --with-png --with-ttf --with-zlib --with-freetype-dir=/usr/local/freetype --with-config-file-path=/server/httpd/conf --with-ffmpeg=/user/local/include
make
make install

安裝完畢
運行 /server/httpd/bin/httpd –k start
測試
<?
phpinfo();
?>                   []如何使PHP支援ffmpegffmpeg-php模組的安裝)下載ffmpeg安裝包地址: http://ffmpeg.mplayerhq.hu/download.html

使用該命令下載ffmpeg: svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

./configure --enable-share --prefix=/usr

make clean && make && make install

下載ffmpeg-php安裝包地址: http://ffmpeg-php.sourceforge.net/

tar -xvf ffmpeg-php-0.4.9.tar

mv ffmpeg-php-0.4.9 php-4.3.6/ext/ffmpeg

cd php-4.3.6/ext/ffmpeg

phpize

cd /opt/software/php-4.3.6

rm configure

./buildconf –force

第二次編譯php,讓它支援ffmpeg-php

./configure --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-freetype --without-gdbm --with-gettext --with-ncurses --with-gmp --with-iconv --with-jpeg-dir=/usr --with-png --enable-ftp --enable-sockets -with-xml --with-dom --with-zlib --enable-track-vars --with-mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-ffmpeg=/user/local/include

make && make install

紅字為需要注意的地方,路徑或參數不同會造成無法載入ffmpeg.so的錯誤.
錯誤提示如:

Warning: dl(): Not supported in multithreaded Web servers - use extension statements in your php.ini

紅字為需要注意的地方,路徑或參數不同會造成無法載入ffmpeg.so的錯誤.
錯誤提示如:
Warning: dl(): Not supported in multithreaded Web servers - use extension statements in your php.ini 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.