Setting Up Video-On-Demand Playback From Red5 Pro Server

Video-On-Demand (VOD) is a subscriber paradigm wherein users can select a pre-recorded stream to watch if and when they wish to do so. As opposed to live streaming content, VOD content is stored on the streaming server for on-demand consumption. A good example of a VOD system on the internet would be YouTube.com, where millions of users are engaged by rich media content each day.


Components of a VOD Setup On Red5 Pro

Setting up video on demand using Red5 Pro is a very simple and subtle process. To complete the setup successfully you would need a few simple basic components:

  1. Media file: A video file encoded in a Red5 Pro compatible file format (Explained below). The format and its content codec need to be compliant with the protocol you choose to stream over.

Red5 Pro Supports Following the Media Formats Commonly Used for Streaming

  • Streaming Video (FLV, F4V, MP4)
  • Streaming Audio (MP3, AAC)

  • Red5 Pro media server: A Red5 Pro server instance deployed online for serving VOD media content to subscribers.

  • Video player: A video player capable of playing your VOD stream. To decode media frames being received from the server you will need a compatible video player which understands the protocol that the media is streamed over. Currently Red5 Pro supports VOD over RTMP(desktop) and RTSP (mobile) only.

No special configuration changes are required to get VOD working with Red5 Pro. VOD works out of the box with Red5 Pro.


Preparing a Video File for Streaming

Red5 Pro supports the following media formats for streaming:

  • Streaming Video (FLV, F4V, MP4, 3GP)
  • Streaming Audio (MP3, F4A, M4A, AAC)

In order for Red5 Pro to be able to stream a recorded media to client, it needs to be in a format understood by Red5 Pro, supported by the protocol used (RTMP/RTSP) and also readable by the client side player.

A file format is like a container which holds audio and/or video data in a single file. Each file format in turn allows storing data encoded in specific codecs only. To keep things simple, we won't be venturing into the depth of codecs and encoding here. Let us, however, take a look at the basic video formats that are compatible with Red5 Pro and the codecs they support.

Commonly used video formats for VOD transmission:

If your file is not in one of these formats you might need to encode your video for compatibility with flash player using a tool such as Adobe media encoder or the open source ffmpeg encoder.

Useful Links


Preparing Red5 Pro for VOD Streaming

Red5 Pro does not require any special configuration changes / programming to get video-on-demand (VOD) working. VOD feature works out of the box as long as you use a properly encoded media file for streaming as per the protocol used and have a compatible media player on client side to receive and decode the stream.

Red5 Pro comes with a pre-installed “VOD” application (found in the webapps directory) which can be used for streaming VOD content over the internet.

To prepare for VOD streaming using Red5 Pro do the following steps.

  1. Start Red5 Pro server if it is not already running.
  2. Copy your media file into : {red5home}/webapps/vod/streams/ directory. If the directory does not exist you will need to create it.

Note: Replace {red5home} with the root directory of your Red5 Pro installation

Red5 Pro VOD playback is available over RTMP (for desktop) and RTSP (for mobile) protocols only. If your file is a valid H264 + AAC content then it will be RTSP & RTMP compatible. RTSP is also playable on desktop using a multi-protocol player such as VLC media player.

  1. Your file is now deployed to Red5 Pro. You can check out the list of available files in the VOD streams directory by visiting: http://{host}:5080/vod/streams.jsp Stream listing
  2. You can then click on the appropriate protocol link (RTMP / RTSP) for a obtaining a playback url for the platform you wish to target: rtsp your-media-name (for rtsp) or flash your-media-name (for rtmp).

Links Example

  • RTMP: rtmp://localhost:1935/vod/mp4:trailer.mp4
  • RTSP: rtsp://localhost:8554/vod/trailer.mp4

RTMP is intended for desktop playback and are played in flash based video players that can be embedded in a browser webpage. flash although an aging technology is supported on most known types of desktop operating system world wide.

RTSP is intended for mobile playback, however you can always play it on desktop as well using special players such as VLC media player. This is only for verification only. RTSP links are meant for playback on mobile only.

  1. Copy the RTSP link of the media file from the stream.jsp page.
  2. In VLC select menu : File => Open Network Stream, and paste the RTSP link.
  3. Click Play.

VLC - Setting Playback URL

VLC - Setting Playback URL

RTSP streams can be played on mobile devices using a mobile based player of your choice, a third party SDK such as JWPlayer SDK, native RTSP playback on android, or the official Red5 Pro SDK.

Setting Up RTMP Playback on Desktop Using JWPlayer

JWPlayer is a standardized and popular video player on the web which supports playback over HTTP, RTMP etc. This session will guide you through setting up Red5 Pro VOD streaming using JWPlayer for Flash.

  1. Create a account on JWPlayer website : https://jwplayer.com/, and login into your account dashboard.
  2. Get your cloud-hosted JWPlayer library JS (JavaScript) link from the dashboard. Each JWPlayer library js is generally an encapsulated player configuration. JWplayer Dashboard - Players
  3. Create a HTML page with the code snippet shown below. The JS library url must be from your own JWPlayer account.
     <html>
       <head>
         <script src="/asset/server/vod/https://content.jwplatform.com/libraries/V6y49PGY.js"></script>
       </head>
       <body>
         <div id="container"></div>
         <script>
           jwplayer("container").setup({
             file: "rtmp://192.233.234.20:1935/vod/mp4:trailer.mp4"
           });
         </script>
       </body>
     </html>
    
  4. If you were using an FLV file then your RTMP URL would look different. (see snippet)
     <html>
     <head>
       <script src="/asset/server/vod/https://content.jwplatform.com/libraries/V6y49PGY.js"></script>
     </head>
     <body>
       <div id="container"></div>
       <script>
         jwplayer("container").setup({
           file: "rtmp://192.233.234.20:1935/vod/trailer.flv"
         });
       </script>
     </body>
     </html>
    
  5. If you have set up things correctly so far, loading the URL in browser should now show you the player. Clicking on the play button starts stream playback. For other possible player configuration options on JWPlayer, you may refer to the extensive JWPlayer documentation online.

VOD Streaming Tips

While the information in this document explains the basic setup process for vod streaming using Red5 Pro, there are always a few real world considerations that can be very insightful to a novice Red5 Pro user.

Given below are a few points to keep in mind when setting up VOD.

  • Always use a video bitrate that is well below the average bandwidth of your targeted audience.
  • When encoding H264 video / using an already encoded H264 video for mobile playback, keep in mind that the video codec must follow a H264 profile well within your targeted audience's device capabilities. More Info.
  • Avoid using arguably huge video files (in GB) that may overload / clog the server.
  • When using RTSP to achieve native playback, ensure that your Android Operating System version supports RTSP playback.