Skip to main content
Skip table of contents

Stream (stream.ini)

To start capturing a stream by the media server, it is necessary to configure it correctly. Each configuration file should contain parameters for one stream.

The path to the stream configuration files is set in the parameter server.media.streams in Mediaserver/Configuration/Server (mediaserver.ini).

The server loads all files with the .ini extension from the directory and ignores other files.

Example configuration file (stream.ini)

YAML
[sample-camera-uid] # stream uid max 36 char length # uid notation is perfect
  primary-node          # stream primary node for dvr and live restreaming
  secondary-node        # stream secondary nodes for dvr and live restreaming
  camera-uid            # optional stream camera id
  stream-name           # optional stream name
  stream-enable         # true\false\on-demand stream
  stream-url =      'rtsp://usr:pwd@host:port/path/stream'
  #stream-url =      'publish://usr:pwd@node-host/sample-camera-uid/'

  stream-proto = rtsp             # enabled restreaming protocols [ rtsp, hls, mse, webrtc ]
  stream-tracks = video           # enabled stream tracks [ video, audio, data ]
  stream-limit = 0                # number of clients. 0 - unlimit
  stream-access = public         # stream access method
                                  # private - need auth-token
                                  # public - access without authorization
                                  # protected - stream-white-list ip restriction
  stream-whitelist = # 173.124.1.1/32

  reconnect-numbers = 500         # number of reconnects, before turn off stream
  reconnect-timeout = 10s         # timeout before reconnect attempt
  reconnect-interval = 30m        # maximum timeout interval
  reconnect-invalid = 10          # number of bad packets before camera go in state invalid

  dvr-enable = true               # enable or disable dvr archive
  dvr-archive = /opt/dvr          # root archive directory
  dvr-duration = 10d              # stored archive duration
  dvr-capacity = 10G              # stored archive disk capacity: N[G|M|%]
  dvr-chunk = 2m                  # archive chunk duration
  dvr-ondemand = false            # enable\disable dvr ondemand mode ( default is false )"

CONFIGURATION PARAMETERS

[sample-camera-uid]required

uid

A unique identifier for the stream within one installation. A string of maximum length 36 characters.

(a-z, A-Z, 0-9, -, ., _){1,48}

stream-urlrequired

url

Connection URL for the stream:

  • rtsp://[user:password]@host[:port]/... - the URL that the server will connect to for capturing the stream

  • publish://[user:password]@hostname[:port]/... - the URL where the server will expect the stream to connect

stream-enablerequired

bool

Allows/Disallows connecting to the stream.

true - Allows loading and connecting to the stream.
false - The stream configuration is loaded, but it is not connected to (only DVR is served).
on-demand - The stream configuration is loaded, but connection is only made when a client requests it.

true

camera-uidrequired

uid

A unique identifier for the camera within one installation. A string of maximum length 48 characters. If the parameter is not specified, the UID of the stream will be used.

(a-z, A-Z, 0-9, -, ., _){1,48}

stream-namerequired

string

Camera name. Used for display as the name of the downloaded video and for better perception in the API. If the parameter is not specified, the UID of the camera will be used.

stream-tracksrequired

array

RTSP stream channels that the server will capture. If the specified channel does not exist in the source stream, it will not be connected to. Possible values for channel types:

  • video - Video channel. If the video channel is not present in the source RTSP stream, it will be disconnected from and stopped working with it.

  • audio - Audio channel. If the audio channel is not present in the source RTSP stream, it will be disconnected from and stopped working with it.

  • application - Allows the server to connect to an ONVIF channel of the stream.

[ video, audio ]

stream-protorequired

array

Protocols by which the client is allowed to connect to the server to view the stream (specified individually for each stream).

[ rtsp, hls ]

stream-accessrequired

string

Defines the type of client authentication when connecting to stream viewing.

none - Connecting clients to the stream for viewing is impossible. At the same time, capture functions and API work are available.
public - Client authentication is not required. Public stream, any client can view the stream from allowed IP addresses.
protected - Connecting to the stream requires authentication using a username and password.
private - Connecting to the stream requires an authorization token, see Mediaserver/Web API/Authorization/CreateAccessToken.

public

stream-whitelistrequired

array

List of allowed IP addresses from which connections to view the stream can be made. Whitelist is the priority parameter, if set, the inclusion of the client's connection IP address is always checked, and then authentication. The following formats can be used: 192.168.1.100, 192.168.1.100/24, 192.168.1.100-192.168.1.105

[]

stream-limitrequired

int

Limits the maximum number of simultaneous client connections for viewing streams across all protocols.

0

dvr-enablerequired

bool

Allows/Disallows the server to record and store a copy of the stream.

false

dvr-archiverequired

path

Sets the root storage directory for DVR.

dvr-durationrequired

seconds

Sets the duration of recording storage.

dvr-capacityrequired

bytes

Limits the size of disk space for recordings. This parameter is informational. It does not impose physical restrictions.

dvr-chunkrequired

seconds

Sets the duration of the recording segment.

reconnect-numbersrequired

int

Sets the number of attempts to reconnect to the stream in case of connection failure before disconnecting the stream.

500

reconnect-invalidrequired

int

The number of 'bad' packets before the camera enters the 'unavailable' state.

10

reconnect-timeoutrequired

seconds

Timeout between connection attempts to the stream.

10

reconnect-intervalrequired

seconds

Maximum connection interval to the stream.

30m

primary-noderequired

string

If the cluster function is enabled, see Mediaserver/Configuration/Server (mediaserver.ini), the parameter sets the host name that is the primary for capturing the stream.

secondary-noderequired

string

Sets the host name that is the backup for capturing the stream in case the primary host is unavailable.

access.auth

typerequired

enum

Defines the type of web authentication.

basic - Basic authentication using a username and password.
digest - Digest authentication using a username and password.

digest

userrequired

string

Username for Basic or Digest authentication.

passwordrequired

string

User password for Basic or Digest authentication.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.