| 1253 | [=#gst-variable-rtsp-server] |
| 1254 | === gst-variable-rtsp-server |
| 1255 | [https://github.com/Gateworks/gst-gateworks-apps/blob/master/src/gst-variable-rtsp-server.c gst-variable-rtsp-server] is a solution created by Gateworks that allows changing the quality of a live stream on the fly based on the number of clients connected to the server. Similar to other adaptive bitrate technologies, it can change quality based on information is knows about the stream. In our case, the number of connected clients was deemed as appropriate. |
| 1256 | |
| 1257 | This application can change the {{{video_bitrate}}} control of the {{{v4l2h264enc}}} element based on the {{{--steps}}} input (default to 5). For example, if using the default {{{steps}}} value of 5, if the min bitrate was 500 and max bitrate was 2000, it would take 5 clients to get from the best to the worst quality. |
| 1258 | |
| 1259 | Example: |
| 1260 | * Start a RTSP server using videotestsrc on default port of 9099 serving H264: |
| 1261 | {{{ |
| 1262 | #!bash |
| 1263 | gst-variable-rtsp-server "videotestsrc ! v4l2h264enc ! rtph264pay name=pay0 pt |
| 1264 | =96" |
| 1265 | }}} |
| 1266 | |
| 1267 | To connect as a client, you can use any program that can connect to an RTSP stream. Below is an example connecting with GStreamer: |
| 1268 | {{{ |
| 1269 | #!bash |
| 1270 | gst-launch-1.0 rtspsrc location=rtsp://172.24.10.180:9099/stream latency=10 ! decodebin ! autovideosink |
| 1271 | }}} |
| 1272 | |
| 1273 | With the above, if there is only a single client, the stream will be at it's best quality. But as you connect more clients, the quality of the stream will drop in order to account for network congestion. |
| 1274 | |