Using Red5 Pro To Record and View Video On Demand
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, or on a CDN (see Using AWS S3 for Video On Demand, for on-demand consumption.
No special configuration changes are required to get VOD working with Red5 Pro. VOD works out of the box with Red5 Pro.
Setting up video on demand using Red5 Pro is a very simple process. To complete the setup successfully you would need a few simple basic components:
- 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 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.
Recording a Stream
To record a file using a mobile client using the Red5 Pro Streaming SDK, set
R5Record type to Record instead of Live.
Using the Red5 Pro iOS Streaming SDK:
self.publishStream!.publish(Testbed.getParameter("stream1") as! String, type: R5RecordTypeRecord)
Using the Red5 Pro Android Streaming SDK:
To record with Flash or WebRTC, set
record instead of
live. See the HTML API docs for more information.
You will find a
/streams directory listed under the app directory you are publishing to. For example, if you publish to a webapp called vod, you will see this directory in
/webapps/vod/streams. While you are publishing/recording, you will see the placeholder files (
And, when you stop broadcasting, there will be a Flash Video (flv) file in the directory with your stream name (i.e.,
You can convert the
flv file to an
mp4 file using transcode post processing.
In addition to the FLV, mobile and WebRTC clients will automatically record an HLS stream (for Flash, you need to force HLS recording).
Subscribing to a Recorded File
If you want to subscribe to your recorded stream using the Red5 Pro client SDK, you simply need to include the file extension (so "stream.flv", or "file.mp4") when calling the subscribe method.
The client is smart enough to look for the recorded file in the "streams" subdirectory if you include a file extension. Without the extension, it assumes the stream is live.
For HLS VOD details, look here).
You can also use a desktop player such as VLC to subscribe to a recorded file. VLC can subscribe to FLV, MP4, and HLS video on demand.
With VLC media player, Open Media
Go to the Network Tab, and type in the URL of your stream (for example,
then press open to view.