Creating a RTSP Server

Show in webframe

Introduction

A RTSP server can deliver several media streams simultaneously and independent of each other. The server listens for connection requests on a TCP/IP port. A RTSP client (like the LEAD RTSP Source filter) can connect and issue RTSP commands to the server. The most common commands are:

A server needs to respond to each of these commands.

The term "media stream" is used because the media being streamed can be a file or a live stream. A live stream can be from a capture device, an MPEG-2 Transport stream received over a UDP port, or an RTSP stream from another server. It can also be from a DVD image - pretty much anything that can be used to create an output file can also be used as a source media stream for a RTSP folder.

Typically, an RTSP server will stream all of the files from a certain folder. Not all compressions are supported by the RTSP streaming technology, so in some cases files with incompatible compressions may need to be transcoded on the fly.

Currently, the LEAD RTSP Sink filter supports H264 video compression and AAC for audio compression. Files with different video or audio compressions would need to recompress the video, audio or both of them.

See the "RFC 2326 - Real Time Streaming Protocol (RTSP)" standard for more information on the RTSP specification.

Security

RTSP servers provide a way to restrict access to content to unauthorized users. RTSP servers can optionally use authentication to allow access only to authorized users. The authentication can be Basic or Digest. In either mode, the users would have to enter a username and password before they can access a media stream. You can use different authentication methods and give different access rights to each media stream. Or you can make it simple and give the same access rights to any media stream.

High Level implementation

LEADTOOLS Multimedia contains some high level objects that make it very easy to implement a RTSP server:

Example:

Suppose you want a RTSP server that streams all of the files from "c:\MyFiles". And you want the server to listen on address 127.0.0.1 at port 554 (default RTSP port). The C# code for a simple server would look like the following code: // Error checking is suppressed here for brevity RTSPServer _server = null; void SetupRTSPServer() { // create the server instance _server = new RTSPServer(); // specify c:\MyFiles as the source folder _server.SetSourceFolder(0, @"c:\MyFiles"); // will listen on 127.0.0.1 _server.TargetAddress = "127.0.0.1"; // start listening on port 554 _server.StartServer(554); }

This server would handle all RTSP URLs with the following format rtsp://127.0.0.1/RelativeURL

As requests to stream the file "c:\MyFiles\RelativeURL". Here are some examples of files you might want to stream and their corresponding URLs

Special note regarding streaming live DVR streams

When the high level RTSP objects are streaming a growing DVR file, they will start streaming from the live position. This enables you to implement live streaming with the RTSP server. In this case, all of the clients are seeing pretty much the same video, regardless of how long ago they connected to the RTSP server.

If you are streaming a DVR file that is not growing anymore, the clients will start playing the video from the beginning of the DVR buffer.

Automatic Recompression in the high level RTSP objects

Streaming a DVR file is also recommended for re-streaming a MPEG-2 Transport UDP stream, since the LEAD MPEG-2 Transport UDP Source filter use DVR files to store the data.

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2013 All Rights Reserved. LEAD Technologies, Inc.