A Node.js server that acts as a virtual ONVIF camera, proxying streams from IP cameras to make them compatible with Network Video Recorders (NVRs) like UniFi Protect.
This project implements a virtual ONVIF server that simulates ONVIF protocol support for cameras that may not natively have it. It creates virtual network interfaces (using macvlan) with unique MAC addresses to represent each camera, making them appear as separate network devices to your NVR.
- Support for multiple NVRs with unique configurations
- Dynamic proxy port assignment to avoid conflicts
- Automatic configuration and network script generation
- Support for both high and low-quality video streams
- Static IP assignment for reliable camera access
- Linux operating system with macvlan support
- Root access for network interface creation
- Node.js runtime environment
- IP cameras with RTSP streams
-
Clone this repository:
git clone https://github.com/molesza/onvif-camera-proxy.git cd onvif-camera-proxy
-
Install dependencies:
npm install
-
Create a configuration for your NVR:
node main.js --create-config
-
Set up the network interfaces (requires root):
sudo ./setup-network-combined.sh
-
Start the server:
node main.js config-combined.yaml --debug
-
Add the virtual cameras to your NVR using the static IPs assigned in the logs.
For detailed setup instructions, troubleshooting, and advanced usage, see the Setup Guide.
graph LR
A[IP Camera] -- RTSP Stream --> B[ONVIF Proxy Server]
B -- Virtual ONVIF Camera --> C[NVR/UniFi Protect]
C -- RTSP Request --> B
B -- Proxied Request --> A
- Configuration: The server discovers your camera's capabilities (resolution, streams, etc.)
- Network Setup: Creates virtual interfaces with unique MAC addresses
- Protocol Translation: Implements ONVIF Device and Media services
- Stream Proxying: Forwards RTSP and snapshot requests to the actual camera
- Virtual Network Interfaces: Each camera gets its own virtual network interface with static IP
- SOAP Services: Implements ONVIF Device and Media service endpoints
- TCP Proxying: Forwards RTSP and HTTP traffic between NVR and cameras
- Dynamic Port Assignment: Automatically assigns unique proxy ports per NVR
- Network interfaces don't persist: Run
setup-network-combined.sh
after each system reboot - EADDRNOTAVAIL error: Ensure you've run the network setup script before starting the server
- Camera discovery issues: Try manual addition with the static IPs shown in the logs
Contributions are welcome! Feel free to open issues or pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.