Tag Archives: streaming

lighthttpd h264 streaming module installation on CentOS

wget http://packages.sw.be/lighttpd/lighttpd-1.4.28-1.el5.rf.i386.rpm
wget http://packages.sw.be/lighttpd/lighttpd-fastcgi-1.4.28-1.el5.rf.i386.rpm
wget http://ftp.heanet.ie/mirrors/pld-linux/dists/2.0/updates/general/i386/lighttpd-mod_h264_streaming-1.4.28-1.i386.rpm
rpm -ivh lighttpd-1.4.28-1.el5.rf.i386.rpm
rpm -ivh lighttpd-fastcgi-1.4.28-1.el5.rf.i386.rpm
rpm -ivh --nodeps lighttpd-mod_h264_streaming-1.4.28-1.i386.rpm

Edit file /etc/lighttpd/lighttpd.conf and modify server.use-ipv6 value in disable. I f you could dedicate one IP, uncomment server.bind and change localhost with IP dedicated.
Edit file /etc/lighttpd/modules.conf and:

  • comment all modules in server.modules
  • in server.modules, add line:
    "mod_h264_streaming",
  • below server.modules, add lines:
    h264-streaming.extensions = ( ".mp4", ".f4v" )
    h264-streaming.buffer-seconds = 10

Start your new web server:
service lighthttpd start
Add web server in runlevel:
chkconfig --add lighttpd
For testing purposes we recommend a tool like wget, or curl):

  • upload one f4v video to the document root of your website:
    wget sample.f4v
    cp sample.f4v /srv/www/lighttpd/
  • download the full file:
    wget -O test.f4v "http://localhost/sample.f4v"
  • download file with specify start time:
    wget -O test.f4v "http://localhost/sample.f4v?start=45.5"
    This saves a file (test.f4v) on your local disk that will have the first 45.5 seconds removed from the original (sample.f4v) video

You can use your favorite player to see if worked okay.

Reference: installation and testing

Red5 IP dedicated configuration

You could setup apache2 on one IP (IP.AP.AC.HE) and Red5 on other IP dedicated (IP.DED.ICA.TED).

  • The first file we need to modify is the server properties file located in the conf directory red5_path/conf/red5.properties:
    sed "s/0.0.0.0/IP.DED.ICA.TED/g" red5_path/conf/red5.properties
  • The second file we need to modify is the apache configuration file in the conf directory /etc/httpd/conf/httpd.conf (or /etc/apache2/apache2.conf):
    sed "s/Listen 80/Listen IP.AP.AC.HE:80/g" /etc/httpd/conf/httpd.conf
  • Now you must reboot server:
    /sbin/reboot

Reference: webmultimediale.org

Red5 port 80 configuration

You could setup HTTP on port 80 and RTMPT on port 80 as well.
We need to modify is the server properties file located in the conf directory: red5_path/conf/red5.properties

  • Locate the http.port key and change it to 80 instead of 5080
  • Do not change the rtmpt.port entry, it should be 8088
  • Save and close the file

Reference: gregoire.org

Red5 installation

CentOS

  • Download and Install Java. RED5 server depends on Java. CentOS 5.3 comes with OpenJDK 1.6 and install it using yum.
    yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel
  • Download and Install Ant (Apache Project). Ant will need to compile RED5 server code. Ant comes in binary form, so just download and install it in /usr/local directory.

    cd /usr/src
    wget http://mirrors.kahuki.com/apache/ant/binaries/apache-ant-1.8.0-bin.tar.bz2
    tar jxvf apache-ant-1.8.0-bin.tar.bz2
    mv apache-ant-1.8.0 /usr/local/ant
  • Export Variables for Ant and Java

    export ANT_HOME=/usr/local/ant
    export JAVA_HOME=/usr/lib/jvm/java
    export PATH=$PATH:/usr/local/ant/bin
    export CLASSPATH=.:$JAVA_HOME/lib/classes.zip

    Also export these variables in /etc/bashrc to become available for every user login or for any terminal opens.

    export ANT_HOME=/usr/local/ >> /etc/bashrc
    export JAVA_HOME=/usr/lib/jvm/ >> /etc/bashrc
    export PATH=$PATH:/usr/local/ant/ >> /etc/bashrc
    export CLASSPATH=.:$JAVA_HOME/lib/classes. >> /etc/bashrc
  • Download and Install RED5 Server. Here the latest version available for RED5 is 0.7 on site but download from google code using svn as the tarball of 0.7 on site is missing some of the files.

    cd /usr/src
    svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
    mv red5 /usr/local/
    cd /usr/local/red5
    ant prepare
    ant dist
  • you will see a ton of lines, but you should get at last

    BUILD SUCCESSFUL

    this mean its install and now copy the conf directory from dist/ and test the red5 installation.

    cp -r dist/conf .
    ./red5.sh

    If it shows Installer service created in the last then everything is fine here, press ctrl+c and move to next step to create init script.

Debian

  • Before beginning this make sure you are running these commands as root. Install Subversion:
    apt-get install subversion
  • Install tools to build your own Debian packages:

    apt-get install dpkg-dev
    apt-get install debhelper
    apt-get install dh-make
    apt-get install devscripts
    apt-get install fakeroot
  • Install Java (see this tutorial for more info):
    apt-get install java-package
  • Install Apache Ant 1.7:

    wget http://apache.mirror.transip.nl/ant/binaries/apache-ant-1.7.0-bin.tar.gz
    gzip -d xf apache-ant-1.7.0-bin.tar.gz
    tar -xf apache-ant-1.7.0-bin.tar
    cd apache-ant-1.7.0
    mv apache-ant-1.7.0 /usr/local/ant
    export ANT_HOME=/usr/local/ant
  • Once Java and Ant are all set up you simply download the latest development version of Red5 to your box.
    svn co http://svn1.cvsdude.com/osflash/red5/java/server/trunk red5-trunk

    That will create a folder in your current directory called red5-trunk.
  • Navigate to the red5-trunk directory and run
    /usr/local/ant/bin/ant
    That will build the project on your machine.
  • At this point you will need to create a red5 directory in the /usr/local/red5 directory.

    mkdir /usr/local/red5
  • Then you will want to copy the contents of the dist(distribution) folder to /usr/local/red5 like so
    cp -R red5-trunk/dist/* /usr/local/red5/
  • We need need to fix the permissions on the red5.sh file:
    cd /usr/local/red5
    chmod 755 red5.sh
  • To run the server you have a few options using the red5.sh file. Run the server by either running
    sh red5.sh &
    or
    ./red5.sh &

    This will start the Red5 service manually.
  • Verify the correct ports are being bound to:
    netstat -ant

Ubuntu

sudo apt-get update
sudo apt-get install subversion
sudo apt-get install java-package
sudo apt-get install sun-java6-jdk
sudo apt-get install ant
mkdir -p ~/svn/red5
cd ~/svn/red5
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5-read-only
export JAVA_HOME=/usr/lib/jvm/java-6-sun
export ANT_HOME=/usr/share/ant/
cd ~/svn/red5/red5-read-only
/usr/share/ant/bin/ant
sudo mkdir /usr/share/red5
cd ~/svn/red5/red5-read-only/dist
sudo cp -R * /usr/share/red5/
cd /usr/share/red5
sudo chmod 755 red5.sh
/usr/share/red5/red5.sh &

Digit on browser: http://localhost:5080 and good luck!

Init Script
Now we will create init script for red5 to start, stop and restart easily.
wget http://ittips.pandle.net/download/script/bash/red5.txt
cp red5.txt /etc/init.d/red5
chmod 755 /etc/init.d/red5

Reference: corsidiinformaticaonline.it, red5server.org, sohailriaz.com