![]() |
Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction | Help Version 19.0.6.3
|
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 an 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, H265 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.
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.
Suppose you want an 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
Case 1: Stream a file from the root of the source folders
Now, try to connect with the LEAD RTSP Source and stream c:\MyFiles\file1.mpg filter using the following URL: rtsp://127.0.0.1/file1.mpg
When the LEAD RTSP server receives this URL, it will look for file1.mpg in all of the source folders. In our case, there is only one folder, so it will look for c:\MyFiles\file1.mpg
Case 2: Stream a file
You can use the same server to also stream from a live video capture device. All you have to do is run a capture from the video and audio capture that you have and write it to a DVR file that you store in c:\Myfiles. The simplest way is to run the DVR demo and set the output file to be something like c:\MyFiles\LiveCapture2.lbl. In this case, you would use the RTSP Source filter to stream the following URL: rtsp://127.0.0.1/LiveCapture2.lbl
Case 3: Re-stream a MPEG2 Transport UDP Stream
Run the MPEG-2 Transport Stream and set its DVR settings to use c:\MyFiles\UDPStream3.lbl. And then use the following URL in the RTSP Source filter: rtsp://127.0.0.1/UDPStream3.lbl
Case 4: Stream a file from a subfolder of the source folders
The server will automatically search in subfolders if a subfolder was specified in the RTSP URL. For example, you might want to keep the DVR files in different subfolders or you just want to reduce the number of files in the root folders.
If you want to stream the file c:\MyFiles\MySubfolder\file4.avi, then you would use the following RTSP URL: rtsp://127.0.0.1/MySubfolder/file4.avi
Note that in this case, the backslash from the source filename is translated into a forward slash in the RTSP URL.
Case 5: Stream a file that is outside the source folders
Let's say you want to stream a file you have on another disk "f:\abc\def.mkv". In this case, you can just create a link called c:\MyFiles\MyLink5.lnk and make it point to f:\abc\def.mkv. You would then use the following URL: rtsp://127.0.0.1/MySubfolder/MyLink5.lnk
This applies to DVDs as well, so you can create a link to d:\VIDEO_TS\VIDEO_TS.IFO called "c:\MyFiles\MyDvd5.lnk" and stream it using the following URL: rtsp://127.0.0.1/MySubfolder/MyDvd5.lnk
In this case, keep in mind that the DVD will be recompressed on the fly and that DVDs take some time to start converting. So you may need to specify a timeout on the RTSP URL to instruct the RTSP filter to wait for the DVD to start converting. The following URL would tell it to wait 10 seconds before giving up with a timeout: rtsp://127.0.0.1/MySubfolder/MyDvd5.lnk?Timeout=10
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.