Red5

From Alessandro's Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

install

  • directory
mkdir /opt/red5 && cd /opt/red5

ls -l /opt/red5/plugins/

  • check theese in plugin folder.
jasper-6.0.18.jar (or newer)
jasper-jdt-6.0.18.jar (or newer)
jasper-el-6.0.18.jar (or newer)

versions

  • 0.6.3
  • 0.8.0
  • 0.9.0
  • 0.9.1
  • 1.0.0

config

plugin installer


admin interface

  1. http://localhost:5080/admin/register.html
  2. fill new user and password
  3. restart red5
  4. http://localhost:5080/demos/adminPanel.html

use

windows and mac

  • Adobe flash media live encoder

linux

where is what

  • SWF app: /opt/red5/webapps/root/demos/ofla_demo.swf
  • source code: /opt/red5/webapps/oflaDemo/WEB-INF/
  • streams: /opt/red5/webapps/oflaDemo/streams/


Xuggler

http://wiki.xuggle.com/Live_Encoding_Tutorial Red5 accepts "stream providers" in form of rtmp streams (or rtmps streams) to allow subscribers (rtmp clients) to view them. Xuggler adds rtmp support to ffmpeg.

Check ffmpeg version

In case you have installed ffmpeg before please check if it supports xuggler:

ffmpeg -i /invalid/file

Your output should look something like:

FFmpeg version SVN-r21606-xuggle-4.0.844, Copyright (c) 2000-2010 Fabrice Bellard, et al.
 built on Feb  2 2010 10:57:41 with gcc 4.4.1
 configuration: --prefix=/home/aclarke/Stage --extra-version=xuggle-4.0.844 --extra-cflags=-I/home/aclarke/Work/internal/xuggle/java/xuggle-xuggler/build/native/i686-pc-linux-gnu/captive/home/aclarke/Stage/include --extra-ldflags=-L/home/aclarke/Work/internal/xuggle/java/xuggle-xuggler/build/native/i686-pc-linux-gnu/captive/home/aclarke/Stage/lib --enable-shared --enable-gpl --enable-nonfree --enable-version3 --disable-stripping --disable-optimizations --disable-mmx --disable-mmx2 --enable-libx264 --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-pthreads
 libavutil     50. 8. 0 / 50. 8. 0
 libavcodec    52.51. 0 / 52.51. 0
 libavformat   52.50. 0 / 52.50. 0
 libavdevice   52. 2. 0 / 52. 2. 0
 libswscale     0. 9. 0 /  0. 9. 0
/invalid/file: no such file or directory

Make sure the --extra-version string above includes "xuggle" in it. If not, you have to continue with installation.

Install it really

Inspired by: http://www.youtube.com/watch?v=PuC_RKLotLE&feature=player_detailpage#t=150s

cd ~
mkdir xuggler-build
cd xuggler-build
http://com.xuggle.s3.amazonaws.com/xuggler/xuggler-3.4.FINAL/xuggle-xuggler.3.4.1012-src.tar.gz
tar -xzvf xuggle-xuggler.3.4.1012-src.tar.gz
export XUGGLE_HOME=/usr/local
export PATH=$XUGGLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$XUGGLE_HOME/lib/:$LD_LIBRARY_PATH
ant run-tests
# 600 bottles of beer later (see video)
ant run-tests
java -cp /usr/local/share/java/jars/xuggle-xuggler.jar com.xuggle.xuggler.demos.GetContainerInfo /home/westermann/video.flv

Now ffmpeg should support "rtmp":

westermann@westermann-desktop:~$ ffmpeg -protocols
FFmpeg version SVN-r21566-xuggle-3.4.843, Copyright (c) 2000-2010 Fabrice Bellard, et al.
  built on Apr 20 2011 13:43:47 with gcc 4.4.3
  configuration: --prefix=/usr/local --extra-version=xuggle-3.4.843 --extra-cflags=-I/home/westermann/Downloads/xuggler/build/native/x86_64-unknown-linux-gnu/captive/usr/local/include --extra-ldflags=-L/home/westermann/Downloads/xuggler/build/native/x86_64-unknown-linux-gnu/captive/usr/local/lib --enable-shared --enable-gpl --enable-nonfree --enable-version3 --enable-libx264 --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-pthreads
 libavutil     50. 8. 0 / 50. 8. 0
 libavcodec    52.49. 0 / 52.49. 0
 libavformat   52.48. 0 / 52.48. 0
 libavdevice   52. 2. 0 / 52. 2. 0
 libswscale     0. 9. 0 /  0. 9. 0
Supported file protocols:
file
gopher
http
pipe
rtmp
rtp
tcp
udp
...

live stream to red5

This demo uses a static video file to test if we can stream to red5. In a real world example one would push a live stream to red5 by having a different source URL (-i).

ffmpeg -i /home/westermann/video.flv -f flv rtmp://127.0.0.1:1935/live/livestream

This will send the video.flv via rtmp to the local red5 to the application /live/ with the streamname "livestream". You should read more about ffmpeg to find out the right parameters for your streaming video.

Red5 will tell something like:

[DEBUG] [NioProcessor-1] org.red5.server.Scope - Add child: org.red5.server.stream.BroadcastScope@adb24
[DEBUG] [NioProcessor-1] org.red5.server.Scope - Add child scope: org.red5.server.stream.BroadcastScope@adb24 to [WebScope@79a422d9 Depth = 1, Path = '/default', Name = 'live']
[INFO] [NioProcessor-1] org.red5.server.stream.ClientBroadcastStream - Provider connect
[INFO] [NioProcessor-1] org.red5.server.stream.ClientBroadcastStream - Stream start
[INFO] [NioProcessor-1] org.red5.server.stream.ClientBroadcastStream - Provider connect

rtmpdump

http://linux.die.net/man/1/rtmpdump

some examples

mkfifo /tmp/fifo
rtmpdump -r "rtmp://some.rtmp.url" -o /tmp/fifo &
vlc /tmp/fifo
rtmpdump -v -r "rtmp://some.rtmp.url" -W "http://www.some.url/SomePlayer.swf" | vlc -vvv -
rtmpdump -v -r "rtmp://204.2.215.118:1935/live?_fcs_vhost=cp42183.live.edgefcs.net&akmfv=1.7" \
-a "live?_fcs_vhost=cp42183.live.edgefcs.net&akmfv=1.7" \
-y "Live1@1094?v1st=null&mt=live1&s_vi=[CS]v1|2798B532051D0619-4000010B80113471[CE]" \
-W "http://www.npr.org/player/v2/audioPlayer.swf" \
-p "http://www.npr.org/player/v2/mediaPlayer.html?action=3&t=live1&islist=false" \
| vlc 

flvstreamer

http://svn.savannah.gnu.org/viewvc/*checkout*/trunk/flvstreamer/README?root=flvstreamer

Subscribe to stream via flash (JWPlayer)

It should be possible to view this live stream now with a JWPlayer with the following integration. This is a only for testing, JWPlayer integration could be done better (e.g. with option for HTML5).

player.html:

 ...
 <script type="text/javascript" src="/somepath/swfobject.js"> 
 </script> 
 <div class="flash420"> 
 <div id="player"> 
 Unfortunately you don't have Adobe Flash-Player....
 <a href="http://get.adobe.com/flashplayer/">Klicken Sie hier für den kostenlosen Adobe Flash-Player.</a> 
 </div><script type="text/javascript"> 
  var flashvars = {
          file:'livestream',
          streamer:'rtmp://10.70.136.1/live/',
          image:'/somepath/millennium_1.jpg',
          bufferlength:'2',
          backcolor:'#000000',
          frontcolor:'#166EBA',
          screencolor:'#999999',
          lightcolor:'#990000',
          autostart:'false',
          repeat:'none',
          stretching:'',
          playlist:'bottom',
          playlistsize:'160',
 
        };
  var params = { allowfullscreen:'false', allowscriptaccess:'always', wmode:'transparent' };
  var attributes = { id:'player1', name:'player1' };
  swfobject.embedSWF('/somepath/player-licensed-5.2.swf','player','384','468','9.0.0','false',flashvars, params, attributes);
 </script> 
 </div> 
 ...

develop

http://trac.red5.org/wiki/Red5Plugin