免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 11163 | 回复: 7
打印 上一主题 下一主题

[Web] [原创]FFmpeg + FFmpeg-PHP + Mplayer + Mencoder + flv2tool 等. [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-12-25 11:18 |只看该作者 |倒序浏览
FFmpeg + FFmpeg-PHP + Mplayer + Mencoder + flv2tool + LAME MP3 Encoder + Libog

[PHPMOTION_PHP5,Video Share Enterprise]
在网上的一个视频分享整站程序,需要上边的环境才能正常运行.最近我正好做了这个环境.所以记录了一个文档,方便大家参考.

安装简介:
请先准备及安装下列需要


1.) MySQL (version 4 or higher)
2.) PHP (version 4.2.3 or higher)
3.) FFmpeg (http://ffmpeg.mplayerhq.hu)
4.) FFmpeg-PHP (http://ffmpeg-php.sourceforge.net)
5.) Mplayer + Mencoder (http://www.mplayerhq.hu/design7/dload.html )
6.) flv2tool (http://inlet-media.de/flvtool2)
7.) LAME MP3 Encoder
8.) Libogg + Libvorbis (http://www.xiph.org/downloads)

上传后运行http://***/install/
安装完成后修改config.php里

$config['ffmpeg']       =  "/usr/local/bin/ffmpeg"; // FFmpeg path
$config['mplayer']        =   '/usr/local/bin/mplayer'; // Mplayer path
$config['mencoder']       =   '/usr/local/bin/mencoder'; // Mencoder path
$config['metainject']     =   '/usr/local/bin/flvtool2'; // Path where the flvtool2 is installed

改成你实际环境.
-----------------------------------------------------------------------------------------
Author : ecore
Website: http://ecore.ishacker.org
Date   : 2007-12-24

1.
[root@fc8 ~]# wget http://apache.mirror.phpchina.com/httpd/httpd-2.2.6.tar.gz

2.
[root@fc8 ~]# wget http://cn2.php.net/distributions/php-5.2.5.tar.gz

3.
[root@fc8 ~]# wget http://ftp.plusline.de/mysql/Dow ... mysql-5.0.51.tar.gz

4.
[root@fc8 ~]# svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

5.
[root@fc8 ~]# wget http://jaist.dl.sourceforge.net/ ... mpeg-php-0.5.1.tbz2

6.
[root@fc8 ~]# wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz

7.
[root@fc8 ~]# wget http://nchc.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz

8.
[root@fc8 ~]# wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz

9.
[root@fc8 ~]# wget http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2

10.
[root@fc8 ~]# wget http://www1.mplayerhq.hu/MPlayer ... al-20071007.tar.bz2

11.
[root@fc8 ~]# wget http://www.mplayerhq.hu/MPlayer/ ... cs-20040703.tar.bz2

12.
[root@fc8 ~]# wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz


下载了所有要用到的包.接着我们来编绎安装.

----------------------------------------------------------------------------------
第一步安装,mysql
[root@fc8 ~]# groupadd mysql
[root@fc8 ~]# useradd -g mysql mysql
[root@fc8 ~]# tar -zxvf mysql-5.0.51.tar.gz
[root@fc8 ~]# cd mysql-5.0.51

[root@fc8 mysql-5.0.51]# ./configure --prefix=/usr/local/mysql
[root@fc8 mysql-5.0.51]# make;make install
[root@fc8 ~]# cp support-files/my-medium.cnf /etc/my.cnf
[root@fc8 ~]# cd /usr/local/mysql
[root@fc8 ~]# bin/mysql_install_db --user=mysql
[root@fc8 ~]# chown -R root  .
[root@fc8 ~]# chown -R mysql var
[root@fc8 ~]# chgrp -R mysql .
[root@fc8 ~]# bin/mysqld_safe --user=mysql &
[root@fc8 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show datebase;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'datebase' at line 1
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql> exit
Bye

mysql到此安坟完毕.
-------------------------------------------------------------------------------------------------
第二步安装apache.

[root@fc8 ~]# tar -zxvf httpd-2.2.6.tar.gz
[root@fc8 ~]# cd httpd-2.2.6
[root@fc8 httpd-2.2.6]# ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite
[root@fc8 httpd-2.2.6]# make;make install
[root@fc8 apache2]# /usr/local/apache2/bin/apachectl start
[root@fc8 apache2]# netstat -anp|grep httpd
tcp        0      0 :::80                       :::*                        LISTEN      19294/httpd         
[root@fc8 apache2]#


apache完装完毕.
--------------------------------------------------------------------------------------------------
安装flvtool
[root@fc8 flvtool2_1.0.5_rc6]# yum install ruby
[root@fc8 flvtool2_1.0.5_rc6]# ruby setup.rb config
[root@fc8 flvtool2_1.0.5_rc6]# ruby setup.rb setup
[root@fc8 flvtool2_1.0.5_rc6]# ruby setup.rb install

安装lame
[root@fc8 ~]# tar -zxvf lame-3.97.tar.gz
[root@fc8 ~]# cd lame-3.97
[root@fc8 lame-3.97]# ./configure
[root@fc8 lame-3.97]#make;make install

安装libogg
[root@fc8 software]# tar -zxvf libogg-1.1.3.tar.gz
[root@fc8 software]# cd libogg-1.1.3
[root@fc8 software]# ./configure;make;make install

安装libvorbis
[root@fc8 ~]# tar -zxvf libvorbis-1.2.0.tar.gz
[root@fc8 ~]# cd libvorbis-1.2.0
[root@fc8 libvorbis-1.2.0]#./configure;make;make install

安装ffmpeg
[root@fc8 software]# cd ffmpeg
[root@fc8 ffmpeg]# ./configure --enable-shared
[root@fc8 ffmpeg]# make;make install

安装mplayer
[root@fc8 ~]# mkdir -p /usr/local/lib/codes
[root@fc8 ~]# mkdir -p /usr/local/lib/win32codcs
[root@fc8 ~]# tar -jxvf essential-20071007.tar.bz2
[root@fc8 ~]# cp -rf essential-20071007/* /usr/local/lib/codes/
[root@fc8 ~]# tar -jxvf win32codecs-20040703.tar.bz2
[root@fc8 software]# cp -rf win32codecs-20040703/* /usr/local/lib/win32codcs/

[root@fc8 ~]# tar -jxvf MPlayer-1.0rc2.tar.bz2
[root@fc8 MPlayer-1.0rc2]# ./configure --prefix=/usr/local/mplayer --enable-gui --enable-freetype --codecsdir=/usr/local/lib/codes --win32codecsdir=/usr/local/lib/win32codcs

[root@fc8 MPlayer-1.0rc2]# make;make install

安装ffmpeg-php.X.XX.tar.gz

1. Unpack the archive

        tar -xjf ffmpeg-php.X.XX.tar.gz

2. cd into the ffmpeg extension directory

        cd ffmpeg-php.X.XX/

3. Run phpize (included with your php install) to build configuration files

        phpize
//这里要用到phpize程序,机子里可能没有,没关系先编绎一个出来,然后用完再删除.
4. Configure and build

        ./configure && make

5. Install the shared extension

        make install (as root)

6. Unpack the archive and copy the ffmpeg extension directory into your the php
   sources extensions directory

#        cp /usr/local/bin/ffmpeg /path/to/php_sources/ext
        cp /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so /path/to/php_sources/ext

7. Run autoconf to rebuild the php configure script and add the --with-ffmpeg
   option

        cd /path/to/php_sources
        autoconf
        


8. 第三步安装php.(使用最新版apache+php整合时,有可能会出现问题,这个时候换低版本的测试.)

[root@fc8 ~]# tar -zxvf php-5.2.4.tar.gz
[root@fc8 php-5.2.4]# cd php-5.2.4
[root@fc8 php-5.2.4]# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql \
--with-config-file-path=/usr/local/php5/etc --with-ffmpeg=yes

[root@fc8 php-5.2.4]# make;make test;make install
[root@fc8 php-5.2.4]# cp php.ini-dist /usr/local/php5/etc/php.ini



安装完毕后,会在apache2的moudle目录下生成一个php*.so文件.
检查httpd.conf文件是否自动加入php相关配置。如果没有手工加入.
LoadModule php5_module        modules/libphp5.so

    AddType application/x-httpd-php .php .php4 .php5
    AddType applicatoin/x-httpd-php-source .phps

然后在apache的htdocs目录下,写一个test.php文件内容如下:
<?
phpinfo();
?>

重启apache.然后访问http://ip/test.php
-------------------------------------------------------------------------------------------


extension = /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so
把这面这一句加入php.ini
把ffmpeg-php-0.5.1目录下的
test_ffmpeg.php
tests目录都cp到apache的htdocs下边.重启apache测试.
http://192.168.0.2/test_ffmpeg.php
-----------------------------------------------------------------------------------------



将论论上传,然后运行安装程序.

[ 本帖最后由 Ecore 于 2007-12-25 14:22 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2007-12-26 08:19 |只看该作者
好复杂的啊,先顶起来再说

论坛徽章:
0
3 [报告]
发表于 2008-01-30 17:15 |只看该作者
这是配波客吗?

论坛徽章:
0
4 [报告]
发表于 2008-02-09 23:32 |只看该作者
首先多谢分享经验.我搜了下你说的那个程序.没找到..是否拼错了或者是别的名字?

论坛徽章:
0
5 [报告]
发表于 2008-02-09 23:51 |只看该作者
:wink: found

论坛徽章:
0
6 [报告]
发表于 2008-03-23 13:48 |只看该作者
没想到网上到处都有转载.呵呵.

论坛徽章:
0
7 [报告]
发表于 2009-10-15 17:15 |只看该作者
提示: 作者被禁止或删除 内容自动屏蔽

论坛徽章:
0
8 [报告]
发表于 2010-03-23 12:35 |只看该作者
上传音视频文件的时候httpd err日志:
[Tue Mar 23 12:24:22 2010] [error] [client 192.168.0.106] [Tue Mar 23 12:24:22 2010] uu_upload.pl: Use of uninitialized value in numeric eq (==) at /var/www/phpmotion/cgi-bin/audio/uu_upload.pl line 357., referer: http://192.168.0.254/audio_uploader.php
[Tue Mar 23 12:24:37 2010] [error] [client 192.168.0.106] script '/var/www/phpmotion/info.php' not found or unable to stat
[Tue Mar 23 12:25:11 2010] [error] [client 192.168.0.106] [Tue Mar 23 12:25:11 2010] uu_upload.pl: Use of uninitialized value in numeric eq (==) at /var/www/phpmotion/cgi-bin/audio/uu_upload.pl line 357., referer: http://192.168.0.254/audio_uploader.php
[Tue Mar 23 12:26:43 2010] [error] [client 192.168.0.106] Use of uninitialized value in numeric eq (==) at /var/www/phpmotion/cgi-bin/uu_upload.pl line 350., referer: http://192.168.0.254/uploader.php
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP