Available in LEADTOOLS Multimedia toolkits. |
RTSP Source URL syntax
The format of the string for RTSP streaming is as follows (optional components are enclosed in square brackets):
rtsp://[username[:password]@]ip_address[:rtsp_port]/server_URL[?param1=val1[¶m2=val2]...[¶mN=valN]]
ip_address: The server's IP address (mandatory). Typically, the RTSP servers use DHCP to obtain an IP address automatically. The servers usually provide a utility for detecting the server's IP address.
server_URL: The server's relative URL (mandatory). Each RTSP server has its own relative URL, so you need to consult the server's manual to obtain it. The end of this page contains a list of server URLs for servers that we tested.
username:password@: The username and password (optional). Some servers restrict access and require the use of a username and password to connect to it. In this situation, the filter will bring up a message box for entering this information. But you can also add it to the URL to speed up the connection and avoid the message box from coming up.
?param1=val1[...]: Extra parameters used to modify the filter or server's behavior (optional). They can be filter parameters (eg: Transport=xxx) or server parameters (eg: compression=jpeg). They can be used to control the connection mode, compression, video size, etc.
For more details and the general form of the complete RTSP URL, please go to IFileSourceFilter::Load.
The Transport optional parameter can be used to select one of the 3 possible streaming modes: Unicast, Multicast and using RTSP tunneling over HTTP. Here are the advantages and disadvantages for each mode:
Unicast (selected with Transport=unicast or by leaving it out):
Pros: Most efficient and most common. The data is streamed using UDP packets sent in Unicast mode from the server to your computer. Each stream uses a different port and the client picks which port it should receive the data on.
Cons: If the server is on a different network, firewalls between the server and the client might prevent the packets from getting through. Also, multiple clients connected to the server at the same time will generate multiple packets for the same video frame being duplicated for each client
Syntax:
rtsp://ip_address[:rtsp_port]/server_URL
rtsp://username:password@ip_address[:rtsp_port]/server_URL
Multicast (selected with Transport=multicast)
Pros: Efficient for situations in which multiple clients are connected to the server at the same time. The data is streamed using UDP packets sent in Multicast mode from the server to your computer. Each stream uses a different port and the server picks which port it should send the data to.
Cons: If the client and the server are not connected to the same router, the multicast packets might get lost. Multicast packets are sent to each computer on the network, so network administrators will sometimes disable multicast traffic.
Syntax:
rtsp://ip_address[:rtsp_port]/server_URL?Transport=multicast
rtsp://username:password@ip_address[:rtsp_port]/server_URL?Transport=multicast
RTSP Tunneling over HTTP (selected with Transport=HTTP):
Pros: The data is streamed using TCP packets sent in Unicast mode from the server to your computer. TCP packets are more likely to go through firewalls, so this gives a better chance of streaming from a RTSP server located on another network.
Cons: All the streams are sent through the same port and are using TCP packets. TCP packets are guaranteed to get through, but this also adds extra overhead compared to UDP so the throughput is reduced. Also, not all RTSP servers support this mode.
Syntax:
rtsp://ip_address[:rtsp_port]/server_URL?Transport=HTTP
rtsp://username:password@ip_address[:rtsp_port]/server_URL?Transport=HTTP
rtsp://192.168.0.164/axis-media/media.amp - Connect to a RTSP server running on 192.168.0.164 at the "axis-media/media.amp" URL. The data will be streamed using the default compression (H264) and Unicast over UDP.
rtsp://192.168.0.164/axis-media/media.amp?Transport=multicast - Connect to a RTSP server running on 192.168.0.164 at the "axis-media/media.amp" URL. The data will be streamed using the default compression (H264) and Multicast over UDP.
rtsp://192.168.0.164/axis-media/media.amp?Transport=HTTP - Connect to a RTSP server running on 192.168.0.164 at the "axis-media/media.amp" URL. The data will be streamed using the default compression (H264) and HTTP tunneling over TCP.
rtsp://192.168.0.164/axis-media/media.amp?videocodec=jpeg - Connect to a RTSP server running on 192.168.0.164 at the "axis-media/media.amp" URL. The data will be streamed using the jpeg compression and Unicast over UDP.
rtsp://192.168.0.164/axis-media/media.amp?Transport=HTTP?videocodec=jpeg - Connect to a RTSP server running on 192.168.0.164 at the "axis-media/media.amp" URL. The data will be streamed using the jpeg compression and HTTP tunneling over TCP.
rtsp://root:pass@192.168.0.164/axis-media/media.amp?videocodec=jpeg - Connect to a RTSP server running on 192.168.0.164 at the "axis-media/media.amp" URL. The data will be streamed using the jpeg compression and Unicast over UDP. This server is using authentication, and we are connecting as username 'root' and with the password 'pass' in order to avoid having to enter a username and password.
rtsp://root:pass@192.168.0.164/axis-media/media.amp?Transport=HTTP&videocodec=jpeg - Connect to a RTSP server running on 192.168.0.164 at the "axis-media/media.amp" URL. The data will be streamed using the jpeg compression and HTTP tunneling over TCP. This server is using authentication, and we are connecting as username 'root' and with the password 'pass' in order to avoid having to enter a username and password.
One of the above URLs shows how to combine a server parameter (videocodec=jpeg) with a LEAD RTSP Source built-in parameter (Transport=HTTP). In general, options are added to the regular URL using '?' character. Multiple options are separated using the '&' character. The order of the options does not matter, so the following two commands will give the same result:
rtsp://192.168.0.164/axis-media/media.amp?Transport=HTTP&videocodec=jpeg
rtsp://192.168.0.164/axis-media/media.amp?videocodec=jpeg&Transport=HTTP
All of the above examples assume the server is listening to the default RTSP port (554). So they omit the port when they specify the URL. If the server is set to respond to a different port number, you will need to add the optional ":rtsp_port" after the server address. The following example assumes the server is listening on port 8003:
rtsp://192.168.0.164:8003/axis-media/media.amp
Note: RTSP URLs for servers that we tested
RTSP server |
Command |
Notes |
Axis v5 platform |
rtsp://192.168.0.164/axis-media/media.amp rtsp://192.168.0.164/axis-media/media.amp?videocodec=jpeg |
This server can stream H.264/jpeg video and AAC audio. First command streams H.264, while the second streams jpeg video. It seems to support Unicast, Multicast and HTTP modes. |
Axis v4 platform (eg: 214 PTZ camera)
|
rtsp://192.168.6.100/mpeg4/media.amp |
Streams mpeg4 video and G.711 audio. G.726 audio are not supported It seems to support Unicast, Multicast and HTTP modes. |
Vivotek VS8102 |
rtsp://192.168.0.172/live.sdp rtsp://192.168.0.172/live2.sdp rtsp://192.168.0.172/live3.sdp rtsp://192.168.0.172/live4.sdp |
This server can set up to 4 types of streams. Select the video and audio compression for each stream. We support H.264, MPEG4 and jpeg video and AAC/AMR audio. It seems to support Unicast, Multicast modes. The HTTP mode did not seem to be supported.
|
Darwin Streaming Server |
rtsp://192.168.6.101/<filename.mp4>
|
<filename.mp4> can be any file or playlist present on the server. The video and audio compression is the same as the audio and video compression of the file. We have tested successfully playback of MPEG4 video and AAC/AMR audio files. |
CISCO RTSP
|
rtsp://192.168.0.172/StreamingSetting?version=1.0&action=getRTSPStream &sessionID=<session_id>&ChannelID=1&ChannelName=Channel1
|
<session_id> is the session id obtained from the url you get when clicking on View Video in the browser. The server uses H264 video and AAC audio.
|