Set Up RTSP Proxy

Configure RTSP proxy to reduce device load and build cascading structures using rtspserver.cfg. Supports on-demand connections and TCP/UDP transfer.

Introduction

The RTSP Proxy feature allows the Happytimesoft RTSP Server to act as an intermediary. It fetches streams from upstream RTSP sources (e.g., cameras, NVRs) and redistributes them to downstream clients.

This reduces the load on the original device and enables the creation of cascading server structures.

How It Works

[RTSP Proxy Flow]
Client → RTSP Server (Proxy) → Original RTSP Source
rtsp://proxy-ip/suffix → (fetches) → rtsp://source-ip/stream

The proxy server fetches the stream from the <url> and makes it available at rtsp://your-ip/<suffix>

Step 1: Edit rtspserver.cfg

Open the RTSP Server's configuration file rtspserver.cfg and locate or add the <proxy> section.

Step 2: Configure Proxy Parameters

Each <proxy> node defines one proxy stream. You can configure multiple nodes.

Parameter Description Example
<suffix> The stream suffix. Clients access the proxy stream via rtsp://your-ip/<suffix> proxy1
<url> The original RTSP stream address to fetch rtsp://192.168.1.3/live
<user> <pass> Login credentials for the original RTSP stream admin admin
<transfer> Transfer protocol: TCP UDP or MULTICAST TCP
<ondemand> Connection mode: 1 = Connect when a client requests (on-demand) 0 = Always keep connected 1

Step 3: Add Configuration Example

Here is a complete example with two proxy streams.

Example: rtspserver.cfg with Two Proxies
<config>
    <serverip>192.168.1.10</serverip>
    <serverport>554</serverport>
    <!-- Other settings... -->

    <proxy>
        <suffix>proxy1</suffix>
        <url>rtsp://192.168.1.3/live</url>
        <user>admin</user>
        <pass>admin</pass>
        <transfer>TCP</transfer>
        <ondemand>1</ondemand>
    </proxy>
    
    <proxy>
        <suffix>proxy2</suffix>
        <url>rtsp://192.168.1.4/live</url>
        <user>admin</user>
        <pass>admin</pass>
        <transfer>TCP</transfer>
        <ondemand>1</ondemand>
    </proxy>
</config>

Step 4: Access Proxy Streams

After starting the RTSP Server, clients can access the proxy streams using the configured suffixes:

  • rtsp://192.168.1.10/proxy1
  • rtsp://192.168.1.10/proxy2

Practical Applications

  • Load Reduction: Prevent a single camera/NVR from being overwhelmed by multiple direct connections.
  • Cascading Structure: Build multi-tier streaming architectures (e.g., edge proxy → central server).
  • Network Optimization: Use TCP transfer in unstable networks for more reliable playback.

Best Practices

  • Use ondemand=1 to save bandwidth and upstream device resources when streams are not always needed.
  • Use ondemand=0 for critical streams that require minimal latency upon client connection.
  • Choose TCP for reliability in lossy networks, UDP for lower latency in stable networks.
  • Secure your proxy server to prevent unauthorized access to upstream streams.