Install Red5 on Debian

Latest versions installed with this tutorial:
Red5 1.0.0 RC2
Java 1.6.0_26
Ant 1.8.4

At least Debian 5 (Lenny) required:
cat /etc/debian_version

Checkout release:
cat /proc/version
uname -a
cat /etc/issue
cat /etc/debian_version

Make sure system can find all require dependencies from /etc/apt/sources.list:
deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main
deb http://ftp.us.debian.org/debian stable main non-free contrib
deb http://ftp.debian.org/debian/ squeeze-updates main
deb-src http://ftp.debian.org/debian/ squeeze-updates main
Comment any cd references with # if distribution cd is not inserted.

If system is not in English, enable that:
dpkg-reconfigure locales
export LANG=en_US.UTF-8

Update /etc/enviroment

You may need to reboot.

 

Update:
apt-get update

Install Subversion:
apt-get -y install subversion

Install tools to build your own Debian packages:
apt-get -y install dpkg-dev debhelper dh-make devscripts fakeroot

Install Java (accept sun license if applies):
apt-get -y install java-package
apt-get -y install sun-java6-jre
apt-get -y install sun-java6-jdk
java -version

Install Apache Ant:
wget http://www.apache.org/dist/ant/binaries/apache-ant-1.8.4-bin.tar.gz
tar zxvf apache-ant-1.8.4-bin.tar.gz
mv apache-ant-1.8.4 /usr/local/ant
export ANT_HOME=/usr/local/ant
/usr/local/ant/bin/ant -version

Download the latest development version of Red5:
svn co http://red5.googlecode.com/svn/java/server/trunk red5-trunk

Run ant to build red5:
cd red5-trunk
/usr/local/ant/bin/ant

Deploy red5:
mkdir /usr/local/red5
cp -R dist/* /usr/local/red5/
cd /usr/local/red5
chmod 755 red5.sh

Deploy your custom apps in/usr/local/red5/webapps .
In example VideoWhisper Red5 RTMP application needed to run VideoWhisper solutions.

Start Red5 in background:
cd /usr/local/red5
./red5.sh >> red5.log &

Verify the correct ports are being bound to:
netstat -ant

 

You need to restart red5 each time you add webapps to /usr/local/red5/webapps or change configuration or restart server.

Close Red5:
cd /usr/local/red5
./red5-shutdown.sh

Or kill Red5 processes:
ps aux | grep red5
kill $process_id

Then start it again:
cd /usr/local/red5
./red5.sh >> red5.log &

 

Can also deploy it as service to start automatically on server boot:

vi /etc/init.d/red5

#! /bin/sh
# put these contents at: /etc/init.d/red5
# change red5 directory path below as necessary
RED5_DIR=/usr/local/red5

start()
{
echo “Starting Red5 Service”
sudo su root -c “cd $RED5_DIR; ./red5.sh > /var/log/red5.log &”
return
}

stop()
{
echo “Shutting down red5”
sudo su root -c ‘killall red5 java’
return
}

case “$1” in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo “Usage: {start|stop|restart}”
exit 1
;;
esac
exit $?

chmod +x /etc/init.d/red5

Use JW Player to play VideoWhisper application streams

With the latest VideoWhisper rtmp applications versions, webmasters can enable external player support (both for FMIS and Red5).  This can be enabled from  RTMP Application Settings.

You need to have allowPlayers=true for FMIS or acceptPlayers=true for Red5 . These settings are turned on by default.

This will allow playing a stream published by a VideoWhisper flash application like Live Streaming with an external player like JW Player.

Demo:

Publish a stream from Live Streaming Demo (i.e. Studio1) and then view it on JW Player. Update channel name in link if you’re using a different one.

VideoWhisper solutions publish regular rtmp streams that can be played with JW Player as per their docs.
Just make sure you fill the videowhisper rtmp address as streamer and user name / channel name + “.flv” as file.

Important: As latest VideoWhisper solutions also support P2P streaming, these need to be configured with alwaysRTMP=1 parameter in their _login.php or equivalent script so streams are always published to RTMP. Because of this, demo above is disabled (to prevent heavy rtmp usage on public install), but you can use sample code in your own installs.

 

 

Here is the code to embed JW Player:

<?
include(“settings.php”);
$stream=$_GET[‘n’];
?>
<object id=”player” classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ name=”player” width=”328″ height=”260″>
<param name=”movie” value=”player.swf” />
<param name=”allowfullscreen” value=”true” />
<param name=”allowscriptaccess” value=”always” />
<param name=”flashvars” value=”file=<?=
urlencode($stream)?>.flv&streamer=<?=urlencode($rtmp_server)?>&autostart=true” />
<object type=”application/x-shockwave-flash” data=”player.swf” width=”328″ height=”260″>
<param name=”movie” value=”player.swf” />
<param name=”allowfullscreen” value=”true” />
<param name=”allowscriptaccess” value=”always” />
<param name=”flashvars” value=”file=<?=
urlencode($stream)?>.flv&streamer=<?=urlencode($rtmp_server)?>&autostart=true” />
<p><a href=”http://get.adobe.com/flashplayer”>Get Flash</a> to see this player.</p>
</object>
</object>

Also this code could be used for playing a Studio1 stream broadcaster with VideoWhisper Live Streaming. Make sure you have swobject.js and player-viral.swf in that folder.

<script type='text/javascript' src='swfobject.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> var so = new SWFObject('player-viral.swf','mpl','320','320','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','always'); so.addParam('wmode','opaque'); so.addVariable('file','Studio1.flv'); so.addVariable('volume','5'); so.addVariable('streamer','rtmp://your-rtmp-server/videowhisper'); so.addVariable('autostart','true'); so.addVariable('quality','false'); so.write('mediaspace'); </script>

JW Player Demo

Interesting Plugins:

  • Adtonomy Text Ads Plugin lets you run your own text ads within the JW FLV Player
  • Google Analytics plugin for the JW Player is designed to help you understand how well your video content is performing online
  • LongTail’s AdSolution allows you to run pre-roll, overlay mid-roll, and post-roll advertisements in your media player
  • LongTail Video’s Adtonomy Plugin lets you run your own FLV advertisements within the JW FLV Player
  • Viral, a video distribution plugin, supports three main functions: embed, link, and recommendations
  • The D-Related plugin allows you to load in list of the related clips in XML format