Skip to main content

Unifi NVR-compatible camera proxy

Project description

UniFi Camera Proxy

About

This enables using non-Ubiquiti cameras within the UniFi Video/Protect software. This is particularly useful to view existing RTSP-enabled cameras in the same UI and mobile app.

Things that work:

  • Live streaming
  • Full-time recording
  • Motion detection
  • Smart Detections with Frigate

Installation

Dependencies:

  • ffmpeg and netcat must be installed
  • Python 3+

Usage

In order to use this, you'll need a client certificate. This can be acquired in one of two ways:

  1. If you have a UniFi camera: scp ubnt@<your-unifi-cam>:/var/etc/persistent/server.pem client.pem
  2. You can also create your own client certificate via:
openssl ecparam -out /tmp/private.key -name prime256v1 -genkey -noout
openssl req -new -sha256 -key /tmp/private.key -out /tmp/server.csr -subj "/C=TW/L=Taipei/O=Ubiquiti Networks Inc./OU=devint/CN=camera.ubnt.dev/emailAddress=support@ubnt.com"
openssl x509 -req -sha256 -days 36500 -in /tmp/server.csr -signkey /tmp/private.key -out /tmp/public.key
cat /tmp/private.key /tmp/public.key > client.pem
rm -f /tmp/private.key /tmp/public.key /tmp/server.csr

Running natively

pip install unifi-cam-proxy
# RTSP stream
unifi-cam-proxy --host <NVR IP> --cert client.pem --token <Adoption token> rtsp -s rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov

Running with Docker

docker run --rm -v "/full/path/to/cert.pem:/client.pem" keshavdv/unifi-cam-proxy unifi-cam-proxy --verbose --ip "<Camera IP>" --host <NVR IP> --cert /client.pem --token <Adoption token> rtsp -s rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov

Acquiring adoption token

Unifi Protect

  1. On the Protect UI, click 'Add Devices' and select 'G3 Micro'. Select 'Continue on Web' and type in a random string for the SSID and Password fields and click 'Generate QR Code'
  2. Take a screenshot of the QR code and upload it to https://zxing.org/w/decode.jspx
  3. Decode the QR code and extract the token from the second to last line in the 'Raw Text' field.

Unifi Video

Follow the 'Token Adoption' step from here to generate a new token

Multiple Cameras

To deploy multiple cameras, run multiple instances of the proxy, taking care to specify different MAC addressess:

unifi-cam-proxy --host <NVR IP> --mac 'AA:BB:CC:00:11:22' --cert client.pem --token <Adoption token> rtsp -s rtsp://camera1
unifi-cam-proxy --host <NVR IP> --mac 'AA:BB:CC:33:44:55' --cert client.pem --token <Adoption token> rtsp -s rtsp://camera2

Device-specific Implementations

  1. Hikvision PTZ (Hikvision DS-2DE3304W-DE): Uses brightness/contrast settings to control PTZ
unifi-cam-proxy -H <NVR IP> -i <camera IP> -c client.pem -t <Adoption token> hikvision -u <username> -p <password>
  1. Reolink NVR Cameras (Reolink RLN16-410): Adds motion events Note: Camera/channel IDs are zero-based
unifi-cam-proxy -H <NVR IP> -i <camera IP> -c client.pem -t <Adoption token> reolink_nvr -u <username> -p <password> -c <camera_id>
  1. Lorex (LNB4321B, likely also Dahua cameras): Adds motion events
unifi-cam-proxy -H <NVR IP> -i <camera IP> -c client.pem -t <Adoption token> lorex -u <username> -p <password>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

unifi-cam-proxy-0.1.2.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

unifi_cam_proxy-0.1.2-py2.py3-none-any.whl (21.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file unifi-cam-proxy-0.1.2.tar.gz.

File metadata

  • Download URL: unifi-cam-proxy-0.1.2.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for unifi-cam-proxy-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f1d791c31ca3e53753fbf90f5e77f18113dc3a4a5438757dd1d7bf2782db241d
MD5 0847f655fa60524791cc3c637068fa85
BLAKE2b-256 1f8284ea480cd7dbdec67b553da06a8ad4c9056e93d11260c6d08faaef94fc48

See more details on using hashes here.

Provenance

File details

Details for the file unifi_cam_proxy-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: unifi_cam_proxy-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5

File hashes

Hashes for unifi_cam_proxy-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4fdd55b3cd2af4e0ea5b4c545a4ed1944904f02323bd401dce38286e7cffc991
MD5 3dc1a28a95a730679c6990e724051f1c
BLAKE2b-256 6b17aa933ddf84fc851870330468c2287cf4f815dcec9bb0b9234dbfa9c063c5

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page