@ -56,19 +56,27 @@ Download and launch the image:
@@ -56,19 +56,27 @@ Download and launch the image:
docker run --rm -it --network=host aler9/rtsp-simple-server
```
The `--network=host` argument is mandatory since Docker can change the source port of UDP packets for routing reasons, and this makes RTSP routing impossible. An alternative consists in disabling UDP and exposing the RTSP port:
The `--network=host` argument is mandatory since Docker can change the source port of UDP packets for routing reasons, and this makes RTSP routing impossible. An alternative consists in disabling UDP and exposing the RTSP port, by providing a configuration file:
```
docker run --rm -it -p 8554:8554 aler9/rtsp-simple-server --protocols=tcp
docker run --rm -it -p 8554:8554 aler9/rtsp-simple-server stdin <<EOF
protocols: [tcp]
EOF
```
#### Publisher authentication
Start the server and set a username and a password:
Create a file named `conf.yml` in the same folder of the executable, with the following content:
@ -93,6 +101,45 @@ The current number of clients, publishers and receivers is printed in each log l
@@ -93,6 +101,45 @@ The current number of clients, publishers and receivers is printed in each log l
means that there are 2 clients, 1 publisher and 1 receiver.
#### Full configuration file
```yaml
# supported stream protocols (the handshake is always performed with TCP)
protocols: [udp, tcp]
# port of the TCP rtsp listener
rtspPort: 8554
# port of the UDP rtp listener
rtpPort: 8000
# port of the UDP rtcp listener
rtcpPort: 8001
# username required to publish
publishUser:
# password required to publish
publishPass:
# IPs or networks (x.x.x.x/24) allowed to publish
publishIps: []
# username required to read
readUser:
# password required to read
readPass:
# IPs or networks (x.x.x.x/24) allowed to read
readIps: []
# script to run when a client connects
preScript:
# script to run when a client disconnects
postScript:
# timeout of read operations
readTimeout: 5s
# timeout of write operations
writeTimeout: 5s
# enable pprof on port 9999 to monitor performance
argRtspPort:=kingpin.Flag("rtsp-port","port of the RTSP TCP listener").Default("8554").Int()
argRtpPort:=kingpin.Flag("rtp-port","port of the RTP UDP listener").Default("8000").Int()
argRtcpPort:=kingpin.Flag("rtcp-port","port of the RTCP UDP listener").Default("8001").Int()
argReadTimeout:=kingpin.Flag("read-timeout","timeout of read operations").Default("5s").Duration()
argWriteTimeout:=kingpin.Flag("write-timeout","timeout of write operations").Default("5s").Duration()
argPublishUser:=kingpin.Flag("publish-user","optional username required to publish").Default("").String()
argPublishPass:=kingpin.Flag("publish-pass","optional password required to publish").Default("").String()
argPublishIps:=kingpin.Flag("publish-ips","comma-separated list of IPs or networks (x.x.x.x/24) that can publish").Default("").String()
argReadUser:=kingpin.Flag("read-user","optional username required to read").Default("").String()
argReadPass:=kingpin.Flag("read-pass","optional password required to read").Default("").String()
argReadIps:=kingpin.Flag("read-ips","comma-separated list of IPs or networks (x.x.x.x/24) that can read").Default("").String()
argPreScript:=kingpin.Flag("pre-script","optional script to run on client connect").Default("").String()
argPostScript:=kingpin.Flag("post-script","optional script to run on client disconnect").Default("").String()
argPprof:=kingpin.Flag("pprof","enable pprof on port 9999 to monitor performance").Default("false").Bool()
argConfPath:=kingpin.Arg("confpath","path to a config file. The default is conf.yml. Use 'stdin' to read config from stdin").Default("conf.yml").String()