Skip to content

Commit 0f9eb43

Browse files
committed
update readme
1 parent 5facab1 commit 0f9eb43

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

README.md

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,14 @@ RTSP_PATHS_TEST_SOURCE=rtsp://myurl ./rtsp-simple-server
8585

8686
The configuration can be changed dinamically when the server is running (hot reloading) by editing the configuration file, Changes are detected and applied without disconnecting existing clients, whenever is possible.
8787

88-
8988
### RTSP proxy mode
9089

9190
_rtsp-simple-server_ is also a RTSP proxy, that is usually deployed in one of these scenarios:
9291
* when there are multiple users that are receiving a stream and the bandwidth is limited; the proxy is used to receive the stream once. Users can then connect to the proxy instead of the original source.
9392
* when there's a NAT / firewall between a stream and the users; the proxy is installed on the NAT and makes the stream available to the outside world.
9493

9594
Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
96-
```yaml
95+
```yml
9796
paths:
9897
proxied:
9998
# url of the source stream, in the format rtsp://user:pass@host:port/path
@@ -102,10 +101,18 @@ paths:
102101
103102
After starting the server, users can connect to `rtsp://localhost:8554/proxied`, instead of connecting to the original url. The server supports any number of source streams, it's enough to add additional entries to the `paths` section.
104103

104+
It's possible to save bandwidth by enabling the on-demand mode: the stream will be pulled only when at least a client is connected:
105+
```yml
106+
paths:
107+
proxied:
108+
source: rtsp://original-url
109+
sourceOnDemand: yes
110+
```
111+
105112
### Serve a webcam
106113

107114
Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
108-
```yaml
115+
```yml
109116
paths:
110117
cam:
111118
runOnInit: ffmpeg -f v4l2 -i /dev/video0 -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH
@@ -125,7 +132,7 @@ Install dependencies:
125132
2. gst-rpicamsrc, by following [instruction here](https://github.com/thaytan/gst-rpicamsrc)
126133
127134
Then edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
128-
```yaml
135+
```yml
129136
paths:
130137
cam:
131138
runOnInit: gst-launch-1.0 rpicamsrc preview=false bitrate=2000000 keyframe-interval=50 ! video/x-h264,width=1920,height=1080,framerate=25/1 ! rtspclientsink location=rtsp://localhost:$RTSP_PORT/$RTSP_PATH
@@ -137,7 +144,7 @@ After starting the server, the webcam is available on `rtsp://localhost:8554/cam
137144
### On-demand publishing
138145

139146
Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
140-
```yaml
147+
```yml
141148
paths:
142149
ondemand:
143150
runOnDemand: ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp rtsp://localhost:$RTSP_PORT/$RTSP_PATH
@@ -148,19 +155,38 @@ The command inserted into `runOnDemand` will start only when a client requests t
148155

149156
### Remuxing, re-encoding, compression
150157

151-
To change the format, codec or compression of a stream, you can use _FFmpeg_ or _Gstreamer_ together with _rtsp-simple-server_. For instance, to re-encode an existing stream, that is available in the `/original` path, and publish the resulting stream in the `/compressed` path, edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
152-
```yaml
158+
To change the format, codec or compression of a stream, use _FFmpeg_ or _Gstreamer_ together with _rtsp-simple-server_. For instance, to re-encode an existing stream, that is available in the `/original` path, and publish the resulting stream in the `/compressed` path, edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
159+
```yml
153160
paths:
154161
all:
155162
original:
156163
runOnPublish: ffmpeg -i rtsp://localhost:$RTSP_PORT/$RTSP_PATH -b:a 64k -c:v libx264 -preset ultrafast -b:v 500k -max_muxing_queue_size 1024 -f rtsp rtsp://localhost:$RTSP_PORT/compressed
157164
runOnPublishRestart: yes
158165
```
159166

167+
### Redirect to another url
168+
169+
To redirect to another URL, use the `redirect` source:
170+
```yml
171+
paths:
172+
redirected:
173+
source: redirect
174+
sourceRedirect: rtsp://otherurl/otherpath
175+
```
176+
177+
### Fallback stream
178+
179+
If no one is publishing to the server, readers can be redirected to a fallback URL that is serving a fallback stream:
180+
```yml
181+
paths:
182+
withfallback:
183+
fallback: rtsp://otherurl/otherpath
184+
```
185+
160186
### Authentication
161187

162188
Edit `rtsp-simple-server.yml` and replace everything inside section `paths` with the following content:
163-
```yaml
189+
```yml
164190
paths:
165191
all:
166192
publishUser: admin
@@ -173,7 +199,7 @@ ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp rtsp://admin:mypassword@lo
173199
```
174200

175201
It's possible to setup authentication for readers too:
176-
```yaml
202+
```yml
177203
paths:
178204
all:
179205
publishUser: admin

0 commit comments

Comments
 (0)