Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

RTSP Server Made Easy with LEADTOOLS

1 Nov 2014 2  
RTSP Server Made Easy with LEADTOOLS

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Introduction

Real Time Streaming Protocol (RTSP) is a popular method of implementing video on demand, security and more, but can be an extremely demanding end to end engineering task. Creating an RTSP Server capable of streaming high quality audio and video data securely and concurrently to hundreds of clients is no small undertaking and can take years to research and develop.

LEADTOOLS, the world’s leading provider of award-winning SDKs for multimedia raster, document and medical imaging, has released in its new RTSP Server technology. In addition to the high level development libraries to expedite the server side development, LEAD’s top-notch play, capture, conversion and DVR can be utilized to develop a high end RTSP client application. Codecs, multiplexers and demultiplexers for h.264, MPEG-4, MPEG-2, JPEG, AAC, AMR and more ensure that your videos are encoded and decoded with the best quality, compression and speed the market has to offer, making LEADTOOLS the complete package for all of your Multimedia development needs.

Key RTSP Server and Client Features in LEADTOOLS Multimedia SDKs

  • Develop a fully-featured and secure RTSP Server with minimal coding
  • Play, pause and stop any RTSP source
  • Connect to any RTSP source with UDP or HTTP protocols
  • Use HTTP Tunneling to stream data from RTSP cameras on another network
  • Supports many popular audio and video compression formats including
    • H.264
    • MPEG-4
    • JPEG
    • AAC
    • AMR
    • G.711
  • Capture and convert streams for archival, burning to DVD or integration with DVR
  • High level .NET, COM and C/C++ interfaces for DirectShow and Media Foundation application development

The RTSP Code

In any RTSP server application, the foundational feature is streaming to and communicating with the client(s). There are many protocol directives including DESCRIBE, SETUP, PLAY, PAUSE and more. The LEADTOOLS RTSPServer object handles them for you with only a few basic lines of code.

class RTSPServerClass
{
   RTSPServer _server = null;
   public void StartServer()
   {
      _server = new RTSPServer(); // create the server instance
      _server.SetSourceFolder(0, @"c:\MyFiles"); // specify c:\MyFiles as the source folder
      _server.TargetAddress = "127.0.0.1"; // will listen on 127.0.0.1
      _server.StartServer(554); // start listening on port 554
   }
 
   public void StopServer()
   {
      _server.StopServer(554);
      _server.Dispose();
   }
}

Now you have a fully functional and compliant RTSP Server to which any media player with RTSP support can connect.

Security is often the most difficult and important aspect of any network-based application, especially when the transmission of sensitive or private information is involved. LEADTOOLS encapsulates all of the necessary security handshakes and communication for you as well. Simply set up the RTSPSecurity object and pass it to the RTSPServer and your server is now secure with either Basic or Digest authentication. The example below sets the security globally, but it can also be set on a per folder basis so that different users are granted access to different materials.

using (RTSPSecurity security = new RTSPSecurity())
{
   security.RealmName = "LEAD RTSP Server Demo";
  
   // Set the security type
   security.AuthenticationRequired = RTSPAuthenticationType.Basic;
   //security.AuthenticationRequired = RTSPAuthenticationType.Digest;
 
   // add only one user
   security.AddUser("User", "Password");
 
   // set this as the security information for all the folders
   _server.SetSecurity(-1, security);
}

Download the Full RTSP Example

You can download a fully functional demo which includes the features discussed above. To run these examples you will need the following:

Support

Need help getting this sample up and going? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team (sales@leadtools.com) or call us at 704-332-5532.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here