SteamStream

From Red5Wiki

Jump to: navigation, search

SteamStream (RTP-to-RTMP restreamer) is a Red5 application created by Jeremy Morton (who can be reached by e-mailing jez9999 AT gmail DOT com). If you wish to suggest changes to the SteamStream source code, please e-mail Jeremy. It's released under the LGPLv2 license.

It provides the functionality, through Red5 and Xuggler (and therefore FFMPEG also), to be able to receive input video streams in RTP format, as described by SDP files, transcode them to Sorenson Spark format (which can be played natively by Flash), and output them to subscribing Flash clients via RTMP. Note that what is doing the transcoding is FFMPEG, not this appication - this application simply 'presents' the SDP file to FFMPEG. This means that it should work with any SDP description that FFMPEG supports the decoding of, but not one that FFMPEG does not support the decoding of. The example described in the SDP file provided on this wiki is of an MPEG4 elementary stream, which FFMPEG does support the decoding of.

To install this application, it is first assumed that you have Red5 installed. If not, install that first. Then, install Xuggler, which can be downloaded from here. PLEASE NOTE that this version of SteamStream was designed to be used with Xuggler version 1.20-FINAL; there may be compatibility and/or licensing issues if you're using it with a different version. That's not to say it won't work with a different version, but you've been warned. :-) It is also assumed that you will be using Eclipse to develop your Red5 Java application.

After installing Red5, load up Eclipse. Set the Red5 'webapps/' directory as your Workspace. Enter the Java perspective. Create a new Java project with the exact name 'steamStream'. Change the source folder from 'src/' to 'WEB-INF/src/' (you'll probably want to create a directory structure as described below before doing this, so 'WEB-INF/src/' already appears in the Package viewer pane). Also change the project's default output folder (for compiled Java .class files) to 'steamStream/WEB-INF/classes/'. After this you'll need to create the relevant files, again as shown in the project structure below. You'll also need to add the following external JARs as libraries in Eclipse:

Bundled with Red5:

red5.jar
slf4j-api-1.5.6.jar
spring-core-2.5.6.jar

Obtain from here and here:

xuggle-xuggler.jar
xuggle-xuggler-red5-1.18.220.jar

The red5.jar file can be found in the root Red5 directory. The other JAR files should be added from the Red5 'lib/' directory; some come bundled with Red5, others should be copied there after being obtained, before being added in Eclipse.

After the .java files have been compiled into .class files in the 'classes/' directory for the webapp, the application should be ready to run. (Re)start Red5 server to get it loaded. You need to create a directory directly under the application's root dir (so, on the same level as the 'WEB-INF' directory) called 'sdpdescriptors/'. Inside there, you should create .sdp file(s) that describe any incoming streams you wish the application to forward to Flash clients. The .sdp filename, sans the '.sdp' suffix, should be the name of the stream to which your Flash client will subscribe with NetStream.play(). So, for a Flash client application connecting to your server's steamStream application and calling something like ns.play("myTestStream"); you would first want to create a file in 'sdpdescriptors/' called 'myTestStream.sdp', which described the incoming RTP stream that should be forwarded when the Flash client connects to "myTestStream".

The source code for this application is provided through this wiki. Its structure is shown below, with files containing either example content, or part of the SteamStream application codebase, linked.


Version 1.2


Application directory structure and files:

steamStream/
  sdpdescriptors/
    sdpFile1.sdp
    [sdpFile2.sdp]
    [sdpFile3.sdp]
    [etc...]
  WEB-INF/
    classes/
      steamStream/
        [classFile1.class]
        [classFile2.class]
        [classFile3.class]
        [etc...]
      logback-steamStream.xml
    src/
      steamStream/
        Application.java
        ReStreamer.java
        SsPlaybackSecurity.java
        SsPublishSecurity.java
    red5-web.properties
    red5-web.xml
    web.xml
Personal tools