Plugin – RTSP Server

Knowledge Base - Plugins
28/05/2020
Print

Real Time Streaming Protocol (RTSP)

The RTSP protocol is an open protocol which facilitates the transfer of audio and video over an IP network. In order to make Sense video available through RTSP, the RTSP plugin is required. This plugin can supply live and on-demand video through an RTSP interface for up to 32 devices simultaneously. Usage of this plugin requires an API License and a minimum of one Sense management server to be available within the network.

Functionality

When the plugin is active, an RTSP stream can be initiated from several media players through a customized URL. The arguments within this URL sets the way in which the video is transmitted.

Configuration

The RTSP plugin can be found in the ‘Plugin’ tab under the label RTSP Server. To enable the plugin, check the checkbox in front of the label. This will show the plugin settings in the lower section.

The plugin contains the following options:

General

  • RTSP Bind to Addresss:
    IP address the media server binds to when streaming RTP over UDP.
    Default: 0.0.0.0 means all networks are allowed to connect.
  • Streaming Port:
    The default streaming port for the RTSP.
  • RTSP Timeout:
    Timeout in milliseconds.

 Sense Interoperability

  • Server Realm
    The name visible when connecting to RTSP stream
  • DIVA /Sense Server Address
    The IP address of the DIVA or Sense server
  • Enable Auto Login
    Check to enable auto login
  • Auto Login Username
    The default username used during auto login

Live Video URL

The generic URL is formatted as follows:

rtsp://<serveraddress>/<serverid or description>?device=<deviceid>&<optional settings>

The figures illustrates how this information can be obtained from Sense Client.

Figure 1: Server ID, Description and IP Address. (Server tab, Sense Client)

 

Figure 2: Device ID. (Devices tab, Sense Client)

 

Within the boundaries of the given example, both of the following URLs would be valid (since it supports both the server id and description):

  • rtsp://172.21.240.91/VDG-Tutorial?device=19
  • rtsp://172.21.240.91/17167089910108338829?device=19

The minimum request URL should always contain at least the server-address, server-ID and device-id. This will return the native video. Resolution, quality and codec are the same as the camera stream.

Recorded video URL

In order to play recorded video, the timestamp argument can be added to the RTSP URL. This argument identifies from which point in time playback needs to commence. The date and time are formatted in a specific way:

YEAR (4 digits); MONTH (2 digits); DAY (2 digits); HOUR (2 digits); MINUTE (2 digits); SECOND (2 digits); MILLISECOND (3 digits, optional)

By this notations, the following 2 timestamps are formatted correctly:

  • 20130226181722 (26-2-2013 18:17:22)
  • 20130226181722455 (26-2-2013 18:17:22.455)

In addition, the following operators can be used combined with the argument:

  • =
    Commences playback on exactly the given date and time.
  • =>
    Commences playback on the first available data after the given date and time.
  • =<
    Commences playback on the last available data before the given date and time.

Example

rtsp://172.21.240.91/VDG-Tutorial?device=3&timestamp=>20170226181722

The request above will play video from camera 3 from 26-2-2017 18:17:22 or later.

Note: Transcoding playback data is not supported!

Authentication

After initiating an RTSP stream, the server will require a username and password. These are identical to those set within the Sense Plugin Manager, please note that the Sense user needs to have sufficient permission for the camera which is requested. Both the username and password are case-sensitive. Figure 3 illustrate the login procedure within VLC media player.

RTSPserver3

Figure 3: Logging in on the RTSP server.

Dual Streaming

By providing a width URI parameter, it’s possible to make use of the dual streaming capabilities of a device.

Example

  • Dual stream url:
    rtsp://<address>/<server-id>?device=<device-id>&width=320
    The width parameter is send to the server, the server determines the correct stream, based on the dual stream setting for the max panel width. No transcoding is performed.

Transcoding

The supplied video can be transcoded. In that case the video will always be supplied in JPEG format, and can be adjusted for the required height, width, quality and bandwidth, if specified. This can be accomplished by combining the transcode (do or do not transcode), width (videowidth) and height videoheight) arguments within the URL.

Note: Transcoding playback data is not supported

Whether to do or do not transcode is identified by the server using a 0 (do not) or 1 (do) value. The video’s height and width are given in pixels.

URI Type Description
transcode  Boolean (0|1)  If set to 1, image will be transcoded
bandwidth  Integer (Kb/s)  Set the maximum bandwidth
width  Integer (pixel)  Video width in pixels
height  Integer (pixel)  Video height in pixels
quality  Integer (percentage)  Quality of the RTSP stream (default 70)
fittopanel  Boolean (0|1)  Add black bars if requested image height/width does not correspond with video resolution

Examples

  • Transcode stream url:
    rtsp://<address>/<server-id>?device=<device-id>&width=320&height=240&transcode=1
    The width, height and transcode parameters are send to the server, the server determines the correct stream, based on the dual stream setting for the max panel width. The stream is transcoded to a JPEG stream with the requested width and height, but it keeps the original aspect-ratio.
  • Transcoding over limited bandwidth url:
    rtsp://<address>/<server-id>?device=<device-id>&width=320&height=240&transcode=1&bandwidth=32
    The stream is transcoded to half the requested width and height, balanced over the limited bandwidth, and keeps the original aspect-ratio.
    The resulting frame-rate will differ and be irregular compared to the original frame-rate, due to the load-balancing.

Related articles

rtsp