2020-06-30 13:12:39 +00:00
|
|
|
|
2021-02-03 08:55:11 +00:00
|
|
|
###############################################
|
2021-06-19 17:20:41 +00:00
|
|
|
# General parameters
|
2021-02-03 08:55:11 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Sets the verbosity of the program; available values are "error", "warn", "info", "debug".
|
2020-12-08 11:21:06 +00:00
|
|
|
logLevel: info
|
2021-12-09 14:11:44 +00:00
|
|
|
# Destinations of log messages; available values are "stdout", "file" and "syslog".
|
2020-11-07 21:28:32 +00:00
|
|
|
logDestinations: [stdout]
|
2021-12-09 14:11:44 +00:00
|
|
|
# If "file" is in logDestinations, this is the file which will receive the logs.
|
2020-11-07 21:28:32 +00:00
|
|
|
logFile: rtsp-simple-server.log
|
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Timeout of read operations.
|
2021-02-03 08:55:11 +00:00
|
|
|
readTimeout: 10s
|
2021-12-09 14:11:44 +00:00
|
|
|
# Timeout of write operations.
|
2021-02-03 08:55:11 +00:00
|
|
|
writeTimeout: 10s
|
2021-12-09 14:11:44 +00:00
|
|
|
# Number of read buffers.
|
|
|
|
# A higher number allows a wider throughput, a lower number allows to save RAM.
|
2021-02-03 08:55:11 +00:00
|
|
|
readBufferCount: 512
|
|
|
|
|
2021-12-22 18:13:56 +00:00
|
|
|
# HTTP URL to perform external authentication.
|
|
|
|
# Every time a user wants to authenticate, the server calls this URL
|
|
|
|
# with the POST method and a body containing:
|
|
|
|
# {
|
|
|
|
# "ip": "ip",
|
|
|
|
# "user": "user",
|
|
|
|
# "password": "password",
|
|
|
|
# "path": "path",
|
|
|
|
# "action": "read|publish"
|
2022-01-11 03:21:18 +00:00
|
|
|
# "query": "url's raw query"
|
2021-12-22 18:13:56 +00:00
|
|
|
# }
|
|
|
|
# If the response code is 20x, authentication is accepted, otherwise
|
|
|
|
# it is discarded.
|
|
|
|
externalAuthenticationURL:
|
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Enable the HTTP API.
|
2021-07-04 16:13:49 +00:00
|
|
|
api: no
|
2021-12-09 14:11:44 +00:00
|
|
|
# Address of the API listener.
|
2021-08-07 16:32:22 +00:00
|
|
|
apiAddress: 127.0.0.1:9997
|
2021-07-04 16:13:49 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Enable Prometheus-compatible metrics.
|
2021-02-03 08:55:11 +00:00
|
|
|
metrics: no
|
2021-12-09 14:11:44 +00:00
|
|
|
# Address of the metrics listener.
|
2021-08-07 17:06:38 +00:00
|
|
|
metricsAddress: 127.0.0.1:9998
|
2021-03-13 17:22:02 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Enable pprof-compatible endpoint to monitor performances.
|
2021-02-03 08:55:11 +00:00
|
|
|
pprof: no
|
2021-12-09 14:11:44 +00:00
|
|
|
# Address of the pprof listener.
|
2021-08-07 17:06:38 +00:00
|
|
|
pprofAddress: 127.0.0.1:9999
|
2021-02-03 08:55:11 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Command to run when a client connects to the server.
|
|
|
|
# This is terminated with SIGINT when a client disconnects from the server.
|
|
|
|
# The following environment variables are available:
|
2021-12-08 19:50:09 +00:00
|
|
|
# * RTSP_PORT: server port
|
2021-02-03 08:55:11 +00:00
|
|
|
runOnConnect:
|
2021-12-09 14:11:44 +00:00
|
|
|
# Restart the command if it exits suddenly.
|
2021-02-03 08:55:11 +00:00
|
|
|
runOnConnectRestart: no
|
|
|
|
|
|
|
|
###############################################
|
2021-06-19 17:20:41 +00:00
|
|
|
# RTSP parameters
|
2021-01-31 15:58:57 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Disable support for the RTSP protocol.
|
2021-03-10 19:19:43 +00:00
|
|
|
rtspDisable: no
|
2021-12-09 14:11:44 +00:00
|
|
|
# List of enabled RTSP transport protocols.
|
2021-07-04 16:16:17 +00:00
|
|
|
# UDP is the most performant, but doesn't work when there's a NAT/firewall between
|
2020-12-13 22:43:31 +00:00
|
|
|
# server and clients, and doesn't support encryption.
|
2021-06-15 20:15:51 +00:00
|
|
|
# UDP-multicast allows to save bandwidth when clients are all in the same LAN.
|
2020-12-13 22:43:31 +00:00
|
|
|
# TCP is the most versatile, and does support encryption.
|
|
|
|
# The handshake is always performed with TCP.
|
2021-06-15 20:15:51 +00:00
|
|
|
protocols: [udp, multicast, tcp]
|
2021-12-09 14:11:44 +00:00
|
|
|
# Encrypt handshake and TCP streams with TLS (RTSPS).
|
|
|
|
# Available values are "no", "strict", "optional".
|
2021-09-26 13:50:35 +00:00
|
|
|
encryption: "no"
|
2021-12-09 14:11:44 +00:00
|
|
|
# Address of the TCP/RTSP listener. This is needed only when encryption is "no" or "optional".
|
2021-04-24 16:25:19 +00:00
|
|
|
rtspAddress: :8554
|
2021-12-09 14:11:44 +00:00
|
|
|
# Address of the TCP/TLS/RTSPS listener. This is needed only when encryption is "strict" or "optional".
|
2021-04-24 16:25:19 +00:00
|
|
|
rtspsAddress: :8555
|
2021-12-09 14:11:44 +00:00
|
|
|
# Address of the UDP/RTP listener. This is needed only when "udp" is in protocols.
|
2021-04-24 16:25:19 +00:00
|
|
|
rtpAddress: :8000
|
2021-12-09 14:11:44 +00:00
|
|
|
# Address of the UDP/RTCP listener. This is needed only when "udp" is in protocols.
|
2021-04-24 16:25:19 +00:00
|
|
|
rtcpAddress: :8001
|
2021-06-21 15:28:00 +00:00
|
|
|
# IP range of all UDP-multicast listeners. This is needed only when "multicast" is in protocols.
|
2021-06-19 17:20:41 +00:00
|
|
|
multicastIPRange: 224.1.0.0/16
|
2021-12-09 14:11:44 +00:00
|
|
|
# Port of all UDP-multicast/RTP listeners. This is needed only when "multicast" is in protocols.
|
2021-06-19 17:20:41 +00:00
|
|
|
multicastRTPPort: 8002
|
2021-12-09 14:11:44 +00:00
|
|
|
# Port of all UDP-multicast/RTCP listeners. This is needed only when "multicast" is in protocols.
|
2021-06-19 17:20:41 +00:00
|
|
|
multicastRTCPPort: 8003
|
2021-12-09 14:11:44 +00:00
|
|
|
# Path to the server key. This is needed only when encryption is "strict" or "optional".
|
|
|
|
# This can be generated with:
|
2021-04-16 20:46:22 +00:00
|
|
|
# openssl genrsa -out server.key 2048
|
|
|
|
# openssl req -new -x509 -sha256 -key server.key -out server.crt -days 3650
|
2020-12-13 22:43:31 +00:00
|
|
|
serverKey: server.key
|
2021-12-09 14:11:44 +00:00
|
|
|
# Path to the server certificate. This is needed only when encryption is "strict" or "optional".
|
2020-12-13 22:43:31 +00:00
|
|
|
serverCert: server.crt
|
2021-12-09 14:11:44 +00:00
|
|
|
# Authentication methods.
|
2020-12-13 22:43:31 +00:00
|
|
|
authMethods: [basic, digest]
|
2021-12-09 14:11:44 +00:00
|
|
|
# Read buffer size.
|
|
|
|
# This doesn't influence throughput and shouldn't be touched unless the server
|
2021-02-18 22:26:45 +00:00
|
|
|
# reports errors about the buffer size.
|
|
|
|
readBufferSize: 2048
|
2021-02-03 08:55:11 +00:00
|
|
|
|
|
|
|
###############################################
|
2021-06-19 17:20:41 +00:00
|
|
|
# RTMP parameters
|
2020-08-05 09:20:11 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Disable support for the RTMP protocol.
|
2021-03-10 19:19:43 +00:00
|
|
|
rtmpDisable: no
|
2021-12-09 14:11:44 +00:00
|
|
|
# Address of the RTMP listener.
|
2021-04-24 16:25:19 +00:00
|
|
|
rtmpAddress: :1935
|
2021-01-31 15:58:57 +00:00
|
|
|
|
2021-04-11 17:05:08 +00:00
|
|
|
###############################################
|
2021-06-19 17:20:41 +00:00
|
|
|
# HLS parameters
|
2021-04-11 17:05:08 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Disable support for the HLS protocol.
|
2021-04-11 17:05:08 +00:00
|
|
|
hlsDisable: no
|
2021-12-09 14:11:44 +00:00
|
|
|
# Address of the HLS listener.
|
2021-04-24 16:25:19 +00:00
|
|
|
hlsAddress: :8888
|
2021-12-09 14:11:44 +00:00
|
|
|
# By default, HLS is generated only when requested by a user.
|
|
|
|
# This option allows to generate it always, avoiding the delay between request and generation.
|
2021-07-29 14:56:40 +00:00
|
|
|
hlsAlwaysRemux: no
|
2021-12-09 14:11:44 +00:00
|
|
|
# Number of HLS segments to generate.
|
|
|
|
# Increasing segments allows more buffering,
|
|
|
|
# Decreasing segments decreases latency.
|
2021-04-11 17:05:08 +00:00
|
|
|
hlsSegmentCount: 3
|
2021-12-09 14:11:44 +00:00
|
|
|
# Minimum duration of each segment.
|
|
|
|
# The final segment duration is also influenced by the interval between IDR frames,
|
2021-08-14 09:40:35 +00:00
|
|
|
# since the server changes the segment duration to include at least a IDR frame in each one.
|
2021-04-11 17:05:08 +00:00
|
|
|
hlsSegmentDuration: 1s
|
2022-01-29 15:10:08 +00:00
|
|
|
# Maximum size of each segment.
|
|
|
|
# This prevents RAM exhaustion.
|
|
|
|
hlsSegmentMaxSize: 50M
|
2021-12-09 14:11:44 +00:00
|
|
|
# Value of the Access-Control-Allow-Origin header provided in every HTTP response.
|
2021-06-23 17:28:27 +00:00
|
|
|
# This allows to play the HLS stream from an external website.
|
|
|
|
hlsAllowOrigin: '*'
|
2021-04-11 17:05:08 +00:00
|
|
|
|
2021-02-03 08:55:11 +00:00
|
|
|
###############################################
|
2021-06-19 17:20:41 +00:00
|
|
|
# Path parameters
|
2020-10-31 15:36:09 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# These settings are path-dependent, and the map key is the name of the path.
|
|
|
|
# It's possible to use regular expressions by using a tilde as prefix.
|
|
|
|
# For example, "~^(test1|test2)$" will match both "test1" and "test2".
|
|
|
|
# For example, "~^prefix" will match all paths that start with "prefix".
|
|
|
|
# The settings under the path "all" are applied to all paths that do not match
|
2020-09-19 15:13:45 +00:00
|
|
|
# another entry.
|
2020-06-30 13:12:39 +00:00
|
|
|
paths:
|
|
|
|
all:
|
2021-12-09 14:11:44 +00:00
|
|
|
# Source of the stream. This can be:
|
2021-08-07 14:08:29 +00:00
|
|
|
# * publisher -> the stream is published by a RTSP or RTMP client
|
2022-01-20 09:39:44 +00:00
|
|
|
# * rtsp://existing-url -> the stream is pulled from another RTSP server / camera
|
|
|
|
# * rtsps://existing-url -> the stream is pulled from another RTSP server / camera with RTSPS
|
2021-09-05 15:35:04 +00:00
|
|
|
# * rtmp://existing-url -> the stream is pulled from another RTMP server
|
|
|
|
# * http://existing-url/stream.m3u8 -> the stream is pulled from another HLS server
|
2021-10-25 18:54:18 +00:00
|
|
|
# * https://existing-url/stream.m3u8 -> the stream is pulled from another HLS server with HTTPS
|
2020-10-27 23:29:53 +00:00
|
|
|
# * redirect -> the stream is provided by another path or server
|
2021-08-07 14:08:29 +00:00
|
|
|
source: publisher
|
2020-10-27 23:29:53 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# If the source is an RTSP or RTSPS URL, this is the protocol that will be used to
|
2021-06-19 17:20:41 +00:00
|
|
|
# pull the stream. available values are "automatic", "udp", "multicast", "tcp".
|
2020-11-21 12:34:27 +00:00
|
|
|
sourceProtocol: automatic
|
2020-12-08 11:21:06 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Tf the source is an RTSP or RTSPS URL, this allows to support sources that
|
2021-11-13 09:15:58 +00:00
|
|
|
# don't provide server ports or use random server ports. This is a security issue
|
|
|
|
# and must be used only when interacting with sources that require it.
|
2021-06-03 21:51:37 +00:00
|
|
|
sourceAnyPortEnable: no
|
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# If the source is a RTSPS or HTTPS URL, and the source certificate is self-signed
|
2021-10-25 19:01:29 +00:00
|
|
|
# or invalid, you can provide the fingerprint of the certificate in order to
|
2021-12-09 14:11:44 +00:00
|
|
|
# validate it anyway. It can be obtained by running:
|
2021-04-16 20:46:22 +00:00
|
|
|
# openssl s_client -connect source_ip:source_port </dev/null 2>/dev/null | sed -n '/BEGIN/,/END/p' > server.crt
|
|
|
|
# openssl x509 -in server.crt -noout -fingerprint -sha256 | cut -d "=" -f2 | tr -d ':'
|
|
|
|
sourceFingerprint:
|
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# If the source is an RTSP or RTMP URL, it will be pulled only when at least
|
2020-10-27 23:29:53 +00:00
|
|
|
# one reader is connected, saving bandwidth.
|
2020-07-29 21:30:42 +00:00
|
|
|
sourceOnDemand: no
|
2021-12-09 14:11:44 +00:00
|
|
|
# If sourceOnDemand is "yes", readers will be put on hold until the source is
|
2020-11-01 15:51:12 +00:00
|
|
|
# ready or until this amount of time has passed.
|
|
|
|
sourceOnDemandStartTimeout: 10s
|
2021-12-09 14:11:44 +00:00
|
|
|
# If sourceOnDemand is "yes", the source will be closed when there are no
|
2020-11-01 15:51:12 +00:00
|
|
|
# readers connected and this amount of time has passed.
|
|
|
|
sourceOnDemandCloseAfter: 10s
|
2020-06-30 13:12:39 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# If the source is "redirect", this is the RTSP URL which clients will be
|
2020-10-27 23:29:53 +00:00
|
|
|
# redirected to.
|
|
|
|
sourceRedirect:
|
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# If the source is "publisher" and a client is publishing, do not allow another
|
2021-03-22 21:15:22 +00:00
|
|
|
# client to disconnect the former and publish in its place.
|
|
|
|
disablePublisherOverride: no
|
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# If the source is "publisher" and no one is publishing, redirect readers to this
|
2021-03-22 21:15:22 +00:00
|
|
|
# path. It can be can be a relative path (i.e. /otherstream) or an absolute RTSP URL.
|
2020-11-01 16:48:00 +00:00
|
|
|
fallback:
|
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Username required to publish.
|
|
|
|
# SHA256-hashed values can be inserted with the "sha256:" prefix.
|
2020-10-31 15:36:09 +00:00
|
|
|
publishUser:
|
2021-12-09 14:11:44 +00:00
|
|
|
# Password required to publish.
|
|
|
|
# SHA256-hashed values can be inserted with the "sha256:" prefix.
|
2020-10-31 15:36:09 +00:00
|
|
|
publishPass:
|
2021-12-09 14:11:44 +00:00
|
|
|
# IPs or networks (x.x.x.x/24) allowed to publish.
|
2021-07-31 15:44:40 +00:00
|
|
|
publishIPs: []
|
2020-10-31 15:36:09 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Username required to read.
|
|
|
|
# SHA256-hashed values can be inserted with the "sha256:" prefix.
|
2020-10-31 15:36:09 +00:00
|
|
|
readUser:
|
|
|
|
# password required to read.
|
2021-12-09 14:11:44 +00:00
|
|
|
# SHA256-hashed values can be inserted with the "sha256:" prefix.
|
2020-10-31 15:36:09 +00:00
|
|
|
readPass:
|
2021-12-09 14:11:44 +00:00
|
|
|
# IPs or networks (x.x.x.x/24) allowed to read.
|
2021-07-31 15:44:40 +00:00
|
|
|
readIPs: []
|
2020-10-31 15:36:09 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Command to run when this path is initialized.
|
|
|
|
# This can be used to publish a stream and keep it always opened.
|
|
|
|
# This is terminated with SIGINT when the program closes.
|
|
|
|
# The following environment variables are available:
|
2021-12-08 19:50:09 +00:00
|
|
|
# * RTSP_PATH: path name
|
|
|
|
# * RTSP_PORT: server port
|
2022-01-25 13:38:57 +00:00
|
|
|
# * G1, G2, ...: regular expression groups, if path name is
|
2021-12-08 19:50:09 +00:00
|
|
|
# a regular expression.
|
2020-07-31 16:12:42 +00:00
|
|
|
runOnInit:
|
2021-12-09 14:11:44 +00:00
|
|
|
# Restart the command if it exits suddenly.
|
2020-10-31 15:36:09 +00:00
|
|
|
runOnInitRestart: no
|
2020-07-31 16:12:42 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Command to run when this path is requested.
|
|
|
|
# This can be used to publish a stream on demand.
|
|
|
|
# This is terminated with SIGINT when the path is not requested anymore.
|
|
|
|
# The following environment variables are available:
|
2021-12-08 19:50:09 +00:00
|
|
|
# * RTSP_PATH: path name
|
|
|
|
# * RTSP_PORT: server port
|
2022-01-25 13:38:57 +00:00
|
|
|
# * G1, G2, ...: regular expression groups, if path name is
|
2021-12-08 19:50:09 +00:00
|
|
|
# a regular expression.
|
2020-07-30 11:43:10 +00:00
|
|
|
runOnDemand:
|
2021-12-09 14:11:44 +00:00
|
|
|
# Restart the command if it exits suddenly.
|
2020-10-31 15:36:09 +00:00
|
|
|
runOnDemandRestart: no
|
2021-12-09 14:11:44 +00:00
|
|
|
# Readers will be put on hold until the runOnDemand command starts publishing
|
2020-11-01 15:51:12 +00:00
|
|
|
# or until this amount of time has passed.
|
|
|
|
runOnDemandStartTimeout: 10s
|
2021-12-09 14:11:44 +00:00
|
|
|
# The command will be closed when there are no
|
2020-11-01 15:51:12 +00:00
|
|
|
# readers connected and this amount of time has passed.
|
|
|
|
runOnDemandCloseAfter: 10s
|
2020-07-30 11:43:10 +00:00
|
|
|
|
2022-01-19 21:50:32 +00:00
|
|
|
# Command to run when the stream is ready to be read, whether it is
|
2022-01-20 09:39:44 +00:00
|
|
|
# published by a client or pulled from a server / camera.
|
2022-01-19 21:50:32 +00:00
|
|
|
# This is terminated with SIGINT when the stream is not ready anymore.
|
2021-12-09 14:11:44 +00:00
|
|
|
# The following environment variables are available:
|
2021-12-08 19:50:09 +00:00
|
|
|
# * RTSP_PATH: path name
|
|
|
|
# * RTSP_PORT: server port
|
2022-01-25 13:38:57 +00:00
|
|
|
# * G1, G2, ...: regular expression groups, if path name is
|
2021-12-08 19:50:09 +00:00
|
|
|
# a regular expression.
|
2022-01-19 21:50:32 +00:00
|
|
|
runOnReady:
|
2021-12-09 14:11:44 +00:00
|
|
|
# Restart the command if it exits suddenly.
|
2022-01-19 21:50:32 +00:00
|
|
|
runOnReadyRestart: no
|
2020-07-30 11:43:10 +00:00
|
|
|
|
2021-12-09 14:11:44 +00:00
|
|
|
# Command to run when a clients starts reading.
|
|
|
|
# This is terminated with SIGINT when a client stops reading.
|
|
|
|
# The following environment variables are available:
|
2021-12-08 19:50:09 +00:00
|
|
|
# * RTSP_PATH: path name
|
|
|
|
# * RTSP_PORT: server port
|
2022-01-25 13:38:57 +00:00
|
|
|
# * G1, G2, ...: regular expression groups, if path name is
|
2021-12-08 19:50:09 +00:00
|
|
|
# a regular expression.
|
2020-07-30 11:43:10 +00:00
|
|
|
runOnRead:
|
2021-12-09 14:11:44 +00:00
|
|
|
# Restart the command if it exits suddenly.
|
2020-10-31 15:36:09 +00:00
|
|
|
runOnReadRestart: no
|