2025 – Present · Sole Creator & Systems Engineer · Systems & IoT · Open-source system project
Camrelay — P2P IP Camera to RTSP Stream Relay
Rust/Tokio tunnel that puts a P2P-only camera behind a private, authenticated RTSP endpoint
What this system is for
Camrelay turns a proprietary camera access problem into a local systems problem: connect to the vendor P2P path, expose a private RTSP stream, and keep recording and archive operations under local control.
What I owned
Rust async runtime, protocol investigation, stream relay, RTSP integration, recording workers, dashboard, and private deployment boundaries.
Device and browser compatibility is described conservatively; a working protocol path is not the same as universal camera support.
Overview & Context
Camrelay turns a proprietary camera access problem into a local systems problem: connect to the vendor P2P path, expose a private RTSP stream, and keep recording and archive operations under local control.
Problem & Constraints
Proprietary IP cameras (Dahua, easy4ip) restrict access behind closed P2P cloud servers, preventing local integration into open-source NVR systems (Frigate, Home Assistant, Scrypted) without subscription fees or vulnerable open ports.
System Architecture
IP Camera (vendor P2P path) ──► [ camrelay: TCP tunnel (Rust / Tokio) ] ──► loopback RTSP auth proxy
│ │
├─► Web UI & probe ├─► RTSP consumers (e.g. NVR)
└─► FFmpeg -c copy segments ──► rclone archive- P2P session setup reaching the camera without port forwarding
- TCP tunnel plus a loopback RTSP authentication proxy (not an RTSP server)
- Optional FFmpeg -c copy segment recorder with rclone offloading
- Embedded HTTP management API and web UI
Engineering Deliverables
- Built an asynchronous Rust daemon (Tokio, Axum) that tunnels TCP to the camera over a vendor P2P path, with realm-based tunnel sessions.
- Implemented the P2P signaling and session setup needed to reach the camera without port forwarding, and kept it isolated from the local RTSP contract.
- Put a loopback RTSP authentication proxy in front of the tunnel so consumers use a normal RTSP URL with credentials.
- Built optional recording workers that run FFmpeg with -c copy (no re-encoding) into segments and archive them with rclone.
- Added an embedded web UI for camera setup and tunnel status.
Engineering Signals & Outcomes
- Rust Async Tokio relay core
- Loopback RTSP auth proxy in front of a TCP tunnel
- FFmpeg -c copy segments + rclone archive
Engineering Outcomes
- A private RTSP boundary that local NVR tooling can consume.
- Protocol-specific relay logic separated from optional recording and archive workers.
- A documented distinction between validated camera paths and compatibility still requiring testing.
Engineering threads behind the project
Each thread links to notes focused on one concrete decision or engineering problem.
Bridging a closed protocol into an open local interface
The interesting part is the boundary: proprietary signaling on one side, a predictable private RTSP contract for NVR tooling on the other.
Technologies & Tooling
Rust · Tokio · RTSP · P2P Signaling · FFmpeg · rclone · Axum