始于2009年10月08日 PM
版本号:Debian-5.03 APC for PHP, 2009年10月08日首版
系统环境 : Debian GNU/Linux 5.03
在配置这个程序的前提是你已安装了apache+php+mysq.如果你还没有安装那么你可以查看LAMP即由Linux+Apache+Mysql+PHP组成的一个WEB开发平台.
现在我们开始这安装为了安装我们需要做一些准备.就算你的apache架设好了.那也需要安装一些支持ffmpeg的动态库.
#apt-get install libjpeg-progs libjpeg62 libjpeg62-dev libsdl1.2-dev php5-dev build-essential unzip subversion ruby libcurses-ruby
下载所需要的软件包:
cd /usr/local/src
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.0.tbz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gzwget http://downloads.xiph.org/releases/theora/libtheora-1.0beta3.tar.gz
wget http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2
1.安装Mplayer所需要的codecs库.
#tar jcvf essential-20071007.tar.bz2
#mv /usr/local/src/essential-20071007/* /usr/local/lib/
#chmod -R 755 /usr/local/lib/
2.安装lame 安装这个可以支持mp3格式.
#tar xvf lame-398-2.tar.gz
#cd lame-398-2
#./configure –enable-mp3x –enable-mp3rtp
#make
#make install
3.安装libogg
#tar xvf libogg-1.1.3.tar.gz #cd /usr/local/src/libogg-1.1.3 #./configure && make && make install 4.安装libvorbis-1.2.3.tar.gz # tar xvf libvorbis-1.2.3.tar.gz # cd libvorbis-1.2.3 # ./configure # make 出错提示: *** Could not run Ogg test program, checking why... *** The test program compiled, but did not run. This usually means *** that the run-time linker is not finding Ogg or finding the wrong *** version of Ogg. If it is not finding Ogg, you'll need to set your *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point *** to the installed location Also, make sure you have run ldconfig if that *** is required on your system *** *** If you have an old version installed, it is best to remove it, although *** you may also be able to get things to work by modifying LD_LIBRARY_PATH configure: error: must have Ogg installed! 解决: # vi /etc/ld.so.conf include /etc/ld.so.conf.d/*.conf /user/local/lib # ldconfig -v 5.安装flvtool. # tar xfv flvtool2_1.0.5_rc6.tgz # cd flvtool2_1.0.5_rc6 # ruby setup.rb config bash: ruby: command not found # apt-get install ruby # ruby setup.rb config ---> bin <--- bin ---> lib ---> lib/flvtool2 <--- lib/flvtool2 ---> lib/flv <--- lib/flv <--- lib samba-server:/usr/local/src/flvtool2_1.0.5_rc6# ruby setup.rb setup ---> bin updating shebang: flvtool2 <--- bin ---> lib ---> lib/flvtool2 <--- lib/flvtool2 ---> lib/flv <--- lib/flv <--- lib # ruby setup.rb install rm -f InstalledFiles ---> bin mkdir -p /usr/bin install flvtool2 /usr/bin/ <--- bin ---> lib mkdir -p /usr/local/lib/site_ruby/1.8 install flvtool2.rb /usr/local/lib/site_ruby/1.8/ install miyaml.rb /usr/local/lib/site_ruby/1.8/ install flv.rb /usr/local/lib/site_ruby/1.8/ install mixml.rb /usr/local/lib/site_ruby/1.8/ ---> lib/flvtool2 mkdir -p /usr/local/lib/site_ruby/1.8/flvtool2 install base.rb /usr/local/lib/site_ruby/1.8/flvtool2 install version.rb /usr/local/lib/site_ruby/1.8/flvtool2 <--- lib/flvtool2 ---> lib/flv mkdir -p /usr/local/lib/site_ruby/1.8/flv install core_extensions.rb /usr/local/lib/site_ruby/1.8/flv install audio_tag.rb /usr/local/lib/site_ruby/1.8/flv install amf_string_buffer.rb /usr/local/lib/site_ruby/1.8/flv install meta_tag.rb /usr/local/lib/site_ruby/1.8/flv install video_tag.rb /usr/local/lib/site_ruby/1.8/flv install tag.rb /usr/local/lib/site_ruby/1.8/flv install stream.rb /usr/local/lib/site_ruby/1.8/flv <--- lib/flv <--- lib 6.安装Mplayer. # tar jvxf MPlayer-1.0rc2.tar.bz # cd MPlayer-1.0rc2 # ./configure && make && make install 7.安装 #tar xvf libtheora-1.0.beta3 #cd /usr/local/src/libtheora-1.0beta3 #./configure #make && make install 8.安装ffmpeg #cd ffmpeg-0.5# # ./configure --prefix=/usr/local --enable-memalign-hack --enable-libvorbis --disable-mmx --enable-shared 9.安装到这里说明插件也安装完了.接下来就是要安装php能支持ffmpeg功能.那么就需要从新编译php. # cd /usr/local/src/php-5.2.8 #./configure --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-gd --with-zlib --with-gettext --with-zlib-dir --with-jpeg-dir --enable-mbstring -with-iconv-dir -with-pod-mysql=/usr/local/mysql --enable-zip --prefix=/usr/local/php 10.安装ffmpeg-php. 在安装这个之后要先代码目录先运行phpize这样才能生成configure文档. #/usr/local/php/bin/phpize Configuring for: PHP Api Version: 20041225 Zend Module Api No: 20060613 Zend Extension Api No: 220060519 Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script. 解决问题: # apt-get install autoconf /usr/local/src/ff/ffmpeg-php-0.6.0# ./configure --with-php-config=/usr/local/php/bin/php-config /usr/local/src/ff/ffmpeg-php-0.6.0#make && make install 安装完后需要加入php.ini让php能支持读取. # vi /usr/local/php/lib/php.ini 加入下面这个. extension_dir="/usr/local/php/lib/php/extensions/no-debug-zts-20060613/ffmpeg.so" extension="ffmpeg.so" 查看phpinfo.php <?php phpinfo(); ?>ffmpeg
| ffmpeg-php version | 0.6.0-svn |
| ffmpeg-php built on | Oct 13 2009 12:19:00 |
| ffmpeg-php gd support | enabled |
| ffmpeg libavcodec version | Lavc51.50.0 |
| ffmpeg libavformat version | Lavf52.7.0 |
| ffmpeg swscaler | disabled |
| Directive | Local Value | Master Value |
|---|---|---|
| ffmpeg.allow_persistent | 0 | 0 |
| ffmpeg.show_warnings | 0 | 0 |
FFmpeg + FFmpeg-PHP + Mplayer + Mencoder + flv2tool + LAME MP3 Encoder + Libog
原创文章,转载请注明: 转载自PT Ubuntu Blog