Information - You can find an article which explains Rtsp and Rtp communication and the idealogy behind the creation of this library at the CodeProject (it has nothing to do with ShartpRTSP.)

New Article's
There is also a series @ CodeProject currently highlighting the new features which will be found in the RC2 Release Dubbed "Flawless". (Soon an article for 'Container' will be added)

See information about the next major release 'Demuxer'!

Update - Support for the following Digital Media Container Formats is now available:

(mp4, mov, 3gp, f4v, etc) Base Media Files

(avi, riff) Resource Interchange Files

(ebml, mkv, mka, mks, mk3d, webm) Extensible Binary Meta-Language / Matroska / WebM Files

(asf, wmv, wma) Advanced Systems /  Windows Media Format

(.mxf, .omf, .aaf) Material eXchange Format

(.gxf) General eXchange Format

(.ogg, .ogv, .oga, .ogm) Ogg Container Format

(.nut) Nut Media Container Format

(.rm, .ra, .rv) Real Media Format

(.ts, .ps, .es, [etc]) Transport, Program and Elementary Streams

Check out the latest source!

Update - There is also COMPLETE support for ALL RTP/AVP Profiles which have been finalized. If your frame type is not implemented or is not working please create an Issue.

The library also contains EXPERIMENTAL facilities for Encoding MPEG and H.264 Streams from Bitmap images as well as re-sourcing HTTP MJPEG and JPEG streams over Rtsp/Rtp. 

You can reliably create a .264 file or .m4e file using the included classes.

Update The RC 2 Release has posted! Get it in the Downloads Section!

Update - The Release Candidate of this Library has been released! Grab it from the Downloads Section!

Update - Checkout the Source History section for a brief look at the latest updates!

If you have a question check out the Discussion Area for help!

Project Description

Delivering media to clients can be a complex and expensive process. This project's goal is to allow developers to deliver media to clients freely in less then 10 lines of code utilizing standards complaint protocol implementations. It also aims to provide a re-usable set of classes for working with Rtsp and Rtp/Rtcp and Sdp.

Example Code

//Create the server optionally specifying the port to listen on
using(Rtsp.RtspServer server = new Rtsp.RtspServer(/*555*/)){

//Create a stream which will be exposed under the name Uri rtsp://localhost/live/RtspSourceTest
//From the RtspSource rtsp://1.2.3.4/mpeg4/media.amp
Media.Rtsp.Server.Media.RtspSource source = new Media.Rtsp.Server.Media.RtspSource("RtspSourceTest", "rtsp://1.2.3.4/mpeg4/media.amp");
            
//If the stream had a username and password
//source.Client.Credential = new System.Net.NetworkCredential("user", "password");
            
//If you wanted to password protect the stream
//source.RtspCredential = new System.Net.NetworkCredential("username", "password");

//Add the stream to the server
server.AddMedia(source);

//Start the server and underlying streams
server.Start();
}

This is all a developer needs to do to get a server streaming from a source!

This library implements Rtsp/RFC2326 and Rtp/RFC3550 in way which is easy to understand and agnostic of the underlying video or audio format being transported.

It supports the concept of RFC4571 framing in TCP and allows TCP streams to be re-sourced over UDP and vicea versa.

The library also supports (De)Multiplexing Rtp and Rtcp from a single Udp socket, e.g. RFC5761.

It provides facilities for Creating and Parsing Rtsp, Rtp and Rtcp and Sdp Packets.

The RtspServer and RtspClient support pushed messages such as "PLAY_NOTIFY" and are observed through events in both classes, this is important for RTSP 2.0 draft compliance.

It also provides a RtspServer so that you can deliver your media to complaint players such as DarwinStreamingServer, VLC, FFMPEG, Mplayer, QuickTime and many many more!

The included RtspClient and RtpClient are standards complaint and support Tcp and Udp transport and switch automatically when required.

This library also provides a RtspServer which supports re-sourcing live streams allowing you to deliver media to as many clients as your server can support without utilizing the bandwidth of the source stream beyond the initial single server connection.

Your clients only talk to the code, they never talk to the source stream.

This allows you to stream in real time from your phone or using a webcam over a modem or other low bandwidth link to virtually unlimited clients with very little overhead.

The underlying implementation is compatible with any video codec and provides RtpPackets or RtpFrames via events so it is up to the developer to do something more with them such as decoding them for viewing or storing them in a file.

The RtspServer does successfully aggregate live Rtsp video streams in ANY container or codec to a compatible RtspClient or Player (VLC, Mplayer Darwin Streaming Server and QuickTime have been tested) 

You can use this project to develop and test custom video codecs or other types of transport where players are not found in abundance or to provide media over Rtsp with Rtp transport.

Types of transport besides Rtp may eventually be added but are not currently supported at this time unless encapsulated inside a RtpPacket / RtcpPacket and through Rtsp.

The library cannot decode individual frames (Except for Jpeg) however you can use it to setup a source stream and then use FFMPEG or VLC to pull the stream down from your local server over Rtsp and extract images utilizing only the resources of the RtspServer and not the source.

It also allows you to password protect a source stream even if the source was not password protected or the other way around.

Developers could also utilize the RtspClient and or the RtpClient without the included RtspServer to allow them to communicate with VoIP systems or other systems and devices which support the Rtsp or Rtp protocol. (Examples are needed but support is available in the Discussion Area for developers using the library)

This library also has facilities for Parsing and Creating Sdp files / RFC4566.

This is not a transcoding project and does not support encoding / decoding of any video codecs, however it does support (de) packetizing Jpeg over Rtp  (format 26 RFC2435) which is sometimes called MJPEG or JPEG over RTP.

This means if you have a camera / server / source which can send a Rtp stream in the Jpeg format you can see the individual frames.

You can also send a series of images over Rtp as Jpeg (RFC2435) as long as the source image format is supported as a System.Drawing.Image.

This lets you turn your Web Camera or Digital Camera or source of images into a LIVE Rtsp Stream!

Recently the library has also added a H264 Encoder and a MPEG Encoder which are experimental and work with System.Drawing.Bitmap, they are provided only for creating video stream data from existing images; thus it is now possible to take a JPEG stream and convert it to MPEG or H.264 (soon to be on the fly and in real time)

This library also has an implementation of reading and writing 'rtpdump' compatible files in various formats.

Archiving is currently be supported through the 'rtpdump' format. Sdp information must be stored separately as of now.

All 'rtpdump' file formats are currently supported! *(Text, ASCII, Hex, Header, Binary, Rtcp, Payload and Short)*!

This project can be used and will eventually contain completely managed version of all 'rtptools'.

For more information on 'rtptools' or the 'rtpdump' format check out the Rtp Tools Home Page

The library has also recently added parsing for all major video file containers, support for writing back to those files is underway. In the future a set of classes for various video containers will be provided which can in turn allow for playback of those supported containers as well with a few Extension Methods convert the archived 'rtpdump' format to those container formats.

In the mean time developers could also utilize the Base Media File Format Library or the SharpAvi Library or The AsfMojo Library to convert to the achieved data which is in the `rtpdump`format to a container they require the media in and then using that same library play it back with the included RtspServer! Enjoy the code and let me know how you use it, what features you feel are missing, incomplete or not included or just to say thanks!

Here are some pictures of the library in action on a Dell Optiplex 755(Core 2 Duo with 8GB Ram)

 

 

 

Last edited Nov 18 at 5:18 PM by juliusfriedman, version 91