RTSPServer

The SmartMEDIA RTSPServer (RTSPServer) application is designed to support RTSP-enabled consoles that do not support the HLS protocol (currently in priority). It can translate RTSP requests transparently to HLS (with FastHLS-specific implementation features). Supports playback and fast forward/rewind.

Command Line Arguments

–help, -h

Print the help to the console and exit.

–version, -v

Print the version to the console and exit.

–config-file, -c

Default value: rtspServerConfig.json

The path to the configuration file.

–log-config, -l

Default value: rtspServer.log.json

The path to the logging configuration file.

–log-file

Default value: rtspServer_%Y-%m-%d_%H-%M-%S.%N.log

Log file name pattern. This option is ignored if –log-config is specified.

The following variables can be used in the file name:

  • Y — year,
  • m — month,
  • d — day,
  • H — hour,
  • M — minute,
  • S — second,
  • N — the file number among files with the same name.

If no variables are defined, the file will be rotated only on service restart.

Configuration File

port, integer 

Default value: 50000

The RTSP port.

user, string 

Default value: empty string

The name of the user whose rights the rtspServer process will have. If no parameter value is specified (an empty string), the process is delegated the rights of the user who started it.

group, string 

Default value: empty string

The name of the group whose rights the rtspServer process will have. If no parameter value is specified (an empty string), the process is delegated the rights of the user group that started it.

rpc_port, integer 

Default value: 49999

The RPC port.

scales, string 

Default value: “8 -8 16 -16 32 -32”

The supported rewind speeds.

stat_print_period, float 

Type: float
Default value: 10

The output interval of packet return statistics for each client, in seconds.

hls_host, string 

Default value: empty string

HLS server URL.

session_prefix, string 

Default value: empty string

The prefix for all session IDs transmitted in Session headers over RTSP and HLS protocols.

session_in_hls_url, boolean 

Default value: 0

If the value is true, the session ID will be added to the HLS request URL.

default_playlist_timeout, float 

Type: float
Default value: 1

The minimum interval before HLS playlist re-requesting, in seconds.

min_hls_pauselive_offset, float 

Type: float
Default value: -10

The minimum interval between the time of data requested by the client application and the current time when playing Pause Live. This interval is required to record the live data. For example, a value of -10 means that if data is requested 5 seconds before the current time, 10 seconds will be returned.

max_npt_gap, float 

Type: float
Default value: 0

The maximum positioning fluctuation (offset from requested position time) when playing local files, in seconds. If set to 0, the fluctuation is not limited.

hls_window_size, float 

Type: float
Default value: 1800

The HLS playlist window size, in seconds.

send_thread_count, integer 

Default value: 4

The number of threads to send data to clients.

read_thread_count, integer 

Default value: 4

The number of threads to receive data from HLS server and read local files.

rtsp_thread_count, integer 

Default value: 4

The number of threads for processing RTSP messages.

max_broken_packets, integer 

Default value: 100

The maximum number of consecutive broken TS packets before the broadcast stops.

session_timeout, integer 

Default value: 120

The KeepAlive interval for RTSP clients, in seconds.

max_hls_retry_count, integer 

Default value: 3

The maximum number of repeated HLS requests in case of server error.

hls_retry_timeout, integer 

Default value: 1000

The interval between repeated HLS requests, in milliseconds.

disable_trick_delimiters, string 

Default value: empty string

A regular expression disabling the addition of P-frame delimiters between I-frames during rewind. Applies to the User-Agent RTSP header.

enable_pcr_correction, string 

Default value: empty string

A regular expression enabling PCR alignment mode during rewind. Applies to the User-Agent RTSP header.

max_pcr_gap, integer 

Default value: 110

The maximum allowed interval between PCR, in milliseconds.

cache_size

Type: size
Default value: 5m

The size of the RTSP streamer cache in bytes.

kreatel_time_offset, integer 

Default value: 300000

The NPT indent when working with Kreatel STB (see the create_user_agent parameter). This is the time in seconds from which NPT tags in Range headers will be calculated: the time from which NPT tags are counted during playback (for STB and server communication). Calculated using the following formula: (the time in URL) – kreatel_time_offset.

kreatel_user_agent, string 

Default value: “.Kreatel.”

A regular expression to determine the Kreatel STB by the User-Agent header.

key_url_regex, string 

Default value: empty string

A regular expression to change the key URL to decrypt the stream. If no value is specified, the original URL is used.

key_url_replace, string 

Default value: empty string

A replacement string for the regular expression specified in the key_url_regex parameter.

Example Configuration

JSON

{

 “port”:50000,

 “content_root”:“/video”,

 “force_hls”:1,

 “hls_host”:“http://127.0.0.1:8802/hls”,

 “has_content_hls_timeout”:3,

 “rtsp_thread_count”:4,

 “read_thread_count”:4,

 “send_thread_count”:4,

 “session_timeout”:60,

 “disabletrick_delimiters”:“.*zyxel.*”,

 “key_url_regex”:“https://[^//]+/(.+)$”,

 “key_url_replace”:“http://sml-smartdrm.int.smlabs.net:12684/$1”

}

Supported RPC Methods

See also the “RPC Methods Common to all Services” chapter.

GetSessionCount()

The method returns the number of active sessions.

GetSessions()

The method returns a list of active session IDs. The ID is an IP address: port.

GetSessionDescription(session_ID)

The method returns the session description by its ID, namely the following fields:

url

Client request URI

scale

Rewind speed

command

The last RTSP command received from the client.

bitrate

Output stream bitrate

userAgent

Client User-Agent

sessionID

Session ID

transportType

RTSP transport. For example, RAW/UDP.

lastActivityTime

Time of the last client request (Unix time).

Usage Example

Bash (Unix Shell)

$ ./rpcClient -s videoserver -p 49911

smartmedia> info

       Method name: GetConfig                     Description: Return main configuration file data

       Method name: GetMethodDescription          Description: Return description of specified method

       Method name: GetMethods                    Description: Return all supported methods

       Method name: GetServiceName                Description: Return service name

       Method name: GetSessionCount               Description: return actual session count

       Method name: GetSessionDescription         Description: return session details

       Method name: GetSessions                   Description: return all actual sessions  [address:port]

       Method name: GetUptime                     Description: Return service uptime in seconds

       Method name: GetVersion                    Description: Return version

smartmedia> GetSessionCount

{

   “result”: “1”

}

smartmedia> GetSessions

{

   “result”: [

       “192.168.0.111:41414”

   ]

}

smartmedia> GetSessionDescription 192.168.0.111:41414

{

   “result”: [

       “url: CH_R03_1TV?pauselife”,

       “scale: 1”,

       “comand: PLAY”,

       “bitrate: 3906 Kb/s”,

       “userAgent: LibVLC/2.2.1 (LIVE555 Streaming Media v2014.01.13)”,

       “sessionID: 102dPXVyQYSPWdFvMnI”,

       “transportType: RAW/UDP”,

       “lastActivityTime: 1447406522.1009436”

   ]

}

smartmedia> exit

CONTENTS
Sign-in
Sign-in with your SmartLabs Support Portal account credentials to see non-public articles.