FFmpeg,FFmpeg-PHP,Mplayer,Mencoder,flv2tool integrated configuration

Have developed a video sharing site, users upload videos, using FFmpeg convert. Flv and .3 gp format.
Web site is very simple procedure, the main task is to configure the video server.
Now the video server configuration steps, share out.
FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec – the leading audio/video codec library.

About the installation:

You need to prepare and install the following:
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)

All need to download the package.

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

Start install

1. Install 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

2. Install 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]#

3. Install Other

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 –enable-shared –prefix=/usr
//Here the recommendation to install /usr. Ffmpeg can do well to find the compiler library files
[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 –prefix=/usr –enable-gpl –enable-shared –enable-libmp3lame –enable-nonfree –enable-libamr-nb –enable-libamr-wb –enable-libvorbis –enable-libxvid –enable-libfaad –enable-libfaadbin –enable-libfaac –enable-libx264 –enable-pthreads –disable-ffserver –disable-ffplay
[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

(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

4. Install 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

After installation, will be in the apache2 directory moudle generate a php *. so files.
Check the httpd.conf file is automatically added to the configuration php. If there is no manual to join.

     LoadModule php5_module modules/libphp5.so

     AddType application / x-httpd-php. Php. Php4. Php5
     AddType applicatoin / x-httpd-php-source. Phps

In apache’s htdocs directory, write a phpinfo.php file as follows:
<?
phpinfo ();
?>

Restart apache. And then visit http://ip/phpinfo.php

Configure php with ffmpeg integration

Join in the php.ini file:
extension = /usr/local/php5/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so

Copy ffmpeg-php-0.5.1/test/ directory,test2.php and test_ffmpeg.php to the apache /htdocs directory

Restart apache test.
http://ip/test/test_ffmpeg.php
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

No Responses to “FFmpeg,FFmpeg-PHP,Mplayer,Mencoder,flv2tool integrated configuration”

Leave a Reply

Name:
Email:
Website:
Comment:
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>