FFMPEG 和 FFMPEG-PHP 的安装

 
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 支持 ffmpeg ffmpeg-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
 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值