Sign inSign up

leandr/rtsp-proxy

By leandr

Updated about 2 months ago

High-performance RTSP/RTP proxy — one upstream camera, many TCP clients

Image
Networking
Web servers
0

204

leandr/rtsp-proxy repository overview

RTSP/1.0 Proxy

High-performance RTSP/RTP proxy for IP cameras. Opens one upstream connection and fans it out to many downstream clients over RTP/AVP/TCP (interleaved).

Cuts load and bandwidth on the camera: multiple viewers share a single session.

Quick start

docker run -d --name rtsp-proxy \
  -p 8554:8554 \
  -p 9090:9090 \
  leandr/rtsp-proxy

Client URL:

rtsp://<host>:8554/rtsp/[user:pass@]<camera-host>[:port]/path

Example:

rtsp://127.0.0.1:8554/rtsp/admin:[email protected]:554/Streaming/Channels/101

Features

  • On-demand connect — upstream only while clients are active
  • Multi-client fanout — one session per user:pass@host/path
  • Auto-reconnect with exponential backoff
  • Idle disconnect — frees the camera when nobody is watching
  • Slow-client isolation — per-client queues; stalled clients don’t block others
  • Digest (qop=auth) & Basic authentication
  • Prometheus metrics on /metrics (optional port)
  • Graceful shutdown (RTSP + metrics)

Ports

PortPurpose
8554RTSP proxy
9090Prometheus metrics

Configuration

All options are CLI flags (override CMD):

docker run --rm -p 8554:8554 -p 9090:9090 leandr/rtsp-proxy \
  -port 8554 \
  -metrics-port 9090 \
  -idle-timeout 20s \
  -packet-queue-size 1000 \
  -buffer-size 65536 \
  -dial-timeout 5s \
  -verbose \
  -log -
FlagDefaultDescription
-port8554*Listen port (*image default; binary default is 554)
-metrics-port9090*Prometheus HTTP port (0 = off)
-idle-timeout20sClose idle upstream
-packet-queue-size1000Per-client RTP queue depth
-buffer-size65536Read buffer size (bytes)
-dial-timeout5sUpstream dial timeout
-verboseoffDetailed RTSP / state logs
-log-Log path (- = stderr)

Metrics

With -metrics-port 9090:

http://<host>:9090/metrics

Counters/gauges include packets forwarded/dropped, bytes, reconnects, active streams/clients, auth failures, uptime.

Protocol support

  • RTSP/1.0
  • RTP over TCP (interleaved only)
  • Digest (qop=auth) and Basic auth
  • SDP rewriting for proxy transparency

UDP / multicast are not supported yet.

Architecture (short)

Client(s) ──TCP──▶ Proxy ──TCP──▶ Camera
              │
              └── single upstream session
                  fan-out via per-client queues

Stream identity: username:password@host/path — different credentials never share a stream.

Security notes

  • Runs as non-root user (rtsp, uid 10001)
  • Prefer non-privileged ports (8554)
  • Do not expose the proxy to the public internet without access control

License / source

See the project repository for license and full documentation.

Tag summary

Content type

Image

Digest

sha256:49f4d22a6

Size

6.5 MB

Last updated

about 2 months ago

docker pull leandr/rtsp-proxy