Coder Social home page Coder Social logo

unifi-cam-proxy's Introduction

unifi-cam-proxy Discord

UniFi Camera Proxy

About

This enables using non-Ubiquiti cameras within the UniFi Protect ecosystem. This is particularly useful to use existing RTSP-enabled cameras in the same UI and mobile app as your other Unifi devices.

Things that work:

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

Documentation

View the documentation at https://unifi-cam-proxy.com

Donations

If you would like to make a donation to support development, please use Github Sponsors.

unifi-cam-proxy's People

Contributors

aaronwebster avatar acortelyou avatar ascott18 avatar bdsoha avatar dependabot[bot] avatar ghostlycrowd avatar hdd avatar jakeshirley avatar keshavdv avatar lcasale avatar networkfusion avatar nmummau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unifi-cam-proxy's Issues

Reolink RLC-820A 8MP Issue

I have a Reolink RLC-820A 8MP cam that outputs a 4K H265 stream, is there some additional command line arguments that I need to include for it to work?

I also have it integrated with frigate so either standalone or with frigate would be acceptable. I attempted to use the RTMP stream from frigate but that doesn't work either.

How to use?

Hey Keshav! I'm interested in your Unifi camera proxy and how to get it working. I have a fleet of AXIS cams that I'd like to use with Unifi Video, but I can't seem to get this working. Is this functional?

Stuck on Updating

So I was able to get this working with my dafang camera at first. I didnt have a hard drive installed in my UDM Pro as I just wanted to see if i could even get this to work.

After I got it working I installed a hard drive and rebooted my UDM Pro, and now all of my camera "Link State" are just stuck on "Updating".

Screenshots of machine running the proxy attached:

Screen Shot 2021-07-20 at 6 19 05 PM

After a while it seems like the proxy program gives up too and this happens:

Screen Shot 2021-07-20 at 6 20 15 PM

MAC Address Command does not work

Hi,

So I'm having an issue getting mulitple cameras to run and I think the root of the issue is around the MAC address command. When I use a single camera without the MAC address it runs fine but, as soon as I use the MAC it fails. I dropped the error as normal.

Working
unifi-cam-proxy -H 10.0.7.1 -i 10.0.7.147 -c client.pem -t RaO0ZP38JIt6g4jzFbZGYYS2lmtHkq9N rtsp -s
'rtsp://user:[email protected]:554/cam/realmonitor?channel=1&subtype=0&unicast=true'

Not-working (without verbose)
unifi-cam-proxy -H 10.0.7.1 --mac 'AA:BB:CC:00:11:22' -i 10.0.7.147 -c client.pem -t RaO0ZP38JIt6g4jzFbZGYYS2lmtHk
q9N rtsp -s 'rtsp://user:[email protected]:554/cam/realmonitor?channel=1&subtype=0&unicast=true'
2021-07-04 16:16:17 raspberrypi RTSPCam[23546] INFO Spawning stream for snapshots: ffmpeg -nostdin -y -re -rtsp_transport tcp -i "rtsp://user:[email protected]:554/cam/realmonitor?channel=1&subtype=0&unicast=true" -vf fps=1 -update 1 /tmp/tmptlohsc5n/screen.jpg
2021-07-04 16:16:17 raspberrypi Core[23546] INFO Creating ws connection to wss://10.0.7.1:7442/camera/1.0/ws?token=RaO0ZP38JIt6g4jzFbZGYYS2lmtHkq9N
Traceback (most recent call last):
File "/home/pi/.local/bin/unifi-cam-proxy", line 10, in
sys.exit(main())
File "/home/pi/.local/lib/python3.7/site-packages/unifi/main.py", line 104, in main
loop.run_until_complete(c.run())
File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "/home/pi/.local/lib/python3.7/site-packages/unifi/core.py", line 67, in run
await connect()
File "/home/pi/.local/lib/python3.7/site-packages/backoff/_async.py", line 66, in retry
ret = await target(*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/unifi/core.py", line 47, in connect
subprotocols=["secure_transfer"],
File "/home/pi/.local/lib/python3.7/site-packages/websockets/legacy/client.py", line 634, in await_impl
extra_headers=protocol.extra_headers,
File "/home/pi/.local/lib/python3.7/site-packages/websockets/legacy/client.py", line 388, in handshake
raise InvalidStatusCode(status_code)
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 403

ffmpeg unknown parameter -stimeout

Liveview / Recording does not work.

Traced this back to the parameter -stimeout that my ffmpeg version does not support.

ffmpeg version git-2021-07-16-cf12a47

Any suggestions?

Command not found?

After "pip install unifi-cam-proxy"(no errors there) on my rpi3b and acquiring the certificate, I try the command line
unifi-cam-proxy --host<IP> --cert client.pem --token <token> rtsp -s rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov

Then I get unifi-cam-proxy: command not found

What am I doing wring?

ubuntu18/python3 "FileNotFoundError: [Errno 2] No such file or directory: 'README.md'"

Not having any luck getting it running, not sure what to do about this error message...

root@nvr:~/unifi# pip install unifi-cam-proxy
Collecting unifi-cam-proxy
Using cached unifi-cam-proxy-0.0.2.tar.gz (8.2 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s5apcc7s/unifi-cam-proxy_ea4f234934234477ac015a5423af6d48/setup.py'"'"'; file='"'"'/tmp/pip-install-s5apcc7s/unifi-cam-proxy_ea4f234934234477ac015a5423af6d48/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-3lsa5doe
cwd: /tmp/pip-install-s5apcc7s/unifi-cam-proxy_ea4f234934234477ac015a5423af6d48/
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-s5apcc7s/unifi-cam-proxy_ea4f234934234477ac015a5423af6d48/setup.py", line 11, in
long_description = open('README.md').read(),
FileNotFoundError: [Errno 2] No such file or directory: 'README.md'
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/8c/01/0ea751bf33959dc5353679656578bcda79d89edf8ad201fb7541984eddb8/unifi-cam-proxy-0.0.2.tar.gz#sha256=1050baeb91599c7ef4b15192f4ee051972d8043bee54ec1fc7b60ba856f44c51 (from https://pypi.org/simple/unifi-cam-proxy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached unifi-cam-proxy-0.0.1.tar.gz (1.9 kB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-s5apcc7s/unifi-cam-proxy_4b49b87641614c2a81d1ac342316cf07/setup.py'"'"'; file='"'"'/tmp/pip-install-s5apcc7s/unifi-cam-proxy_4b49b87641614c2a81d1ac342316cf07/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-kwswkuif
cwd: /tmp/pip-install-s5apcc7s/unifi-cam-proxy_4b49b87641614c2a81d1ac342316cf07/
Complete output (5 lines):
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-s5apcc7s/unifi-cam-proxy_4b49b87641614c2a81d1ac342316cf07/setup.py", line 4, in
from unifi import version
ImportError: cannot import name 'version'
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/c6/ba/e6cbe7d92f500e8a9a7a04955b9dd395e31fb80b73b07831a48e5f504def/unifi-cam-proxy-0.0.1.tar.gz#sha256=0b10562e91c9819f64d1a1aa753e12233f0cc66c7dfa48529b6b0af8a8dd6460 (from https://pypi.org/simple/unifi-cam-proxy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement unifi-cam-proxy (from versions: 0.0.1, 0.0.2)
ERROR: No matching distribution found for unifi-cam-proxy

any ideas?

Which python? Which Pip? 3.7+

I see that it requires python 3+ but uses pip to install so is it installing via 2.7 or 3 when I run it I get these errors

2021-06-10 05:26:22 unifi-cam-proxy Core[9838] DEBUG Message contents: {u'from': u'UniFiVideo', u'functionName': u'ubnt_avclient_hello', u'inResponseTo': 1, u'to': u'ubnt_avclient', u'messageId': 10014, u'payload': {u'controllerUuid': u'c0f5d6fd-4dcc-4641-acb4-e8c7518bbc4f', u'overrideUuid': True, u'controllerName': u'UDM Pro Home', u'controllerVersion': u'1.18.1', u'protocolVersion': 67}}
Traceback (most recent call last):
  File "/usr/local/bin/unifi-cam-proxy", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/unifi/main.py", line 58, in main
    c.run()
  File "/usr/local/lib/python2.7/dist-packages/unifi/core.py", line 759, in run
    reconnect = self.process(ws, msg)
  File "/usr/local/lib/python2.7/dist-packages/unifi/core.py", line 666, in process
    if m["responseExpected"] == False and m["functionName"] not in [
KeyError: 'responseExpected'

Should I use pip3 to install unifi-cam-proxy? because I tried but wont install

root@unifi-cam-proxy:~# pip3 install unifi-cam-proxy
Collecting unifi-cam-proxy
  Using cached https://files.pythonhosted.org/packages/8c/01/0ea751bf33959dc5353679656578bcda79d89edf8ad201fb7541984eddb8/unifi-cam-proxy-0.0.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-thj5aqb1/unifi-cam-proxy/setup.py", line 11, in <module>
        long_description = open('README.md').read(),
    FileNotFoundError: [Errno 2] No such file or directory: 'README.md'

Not sure what to try next

Support configurable snapshots for RSTP.

I noticed you extended RSTPCam with RSTPMotion and then merged the two, this is currently written as an extension but I see this being merged with the normal RSTPCam such that you can either choose a custom snapshot location or allow ffmpeg to do it's thing. On a Jetson Nano with two cameras the CPU was 100% loaded before this change and now it's barely breaking a sweat.

import os
import asyncio
import aiofiles
import aiohttp

from unifi.cams.rtsp import RTSPCam


class RTSPSnapshotCam(RTSPCam):

    def __init__(self, args, logger=None):
        super().__init__(args, logger)
        self.session = aiohttp.ClientSession(auth=aiohttp.BasicAuth(self.args.username, self.args.password))

    @classmethod
    def add_parser(self, parser):
        super().add_parser(parser)
        parser.add_argument("--username", "-u", required=True, help="Camera username")
        parser.add_argument("--password", "-p", required=True, help="Camera password")
        parser.add_argument("--snapshot_url", "-i", required=True, help="Snapshot image")

    async def get_snapshot(self):
        img_file = "{}/screen.jpg".format(self.snapshot_dir)
        url = self.args.snapshot_url
        self.logger.info(f"Fetching snapshot... {img_file} {url}")
        try:
            async with self.session.request("GET", url) as resp:
                async with aiofiles.open(img_file, "wb") as f:
                    # async for data in resp.content.iter_chunked(1024):
                    await f.write(await resp.read()) # (data)
        except aiohttp.ClientError:
            self.logger.error("Failed to get snapshot")
        return img_file

If its simpler we could look at not including username and password arguments and just write it directly into the URL (e.g. http://username:password@host/snapshot.cgi)

Dream Machine, Lorex camera and Raspberry PI

Hello,

This mite be a screech and I'm not really a good programmer.

Need little help.

so I install with sudo pip install unifi-cam-proxy

the dream machine doesn't have an easy place to find the auth token. I pulled the support file off the camera and found in the file

"adopted": true,
"authToken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"cfgver": 1,

my config

sudo unifi-cam-proxy --host 192.168.5.1 --mac 00:40:7F:8B:E2:AF --cert client.pem --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx rtsp -s rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0

my response back

[2] 2721
[1] Exit 1 unifi-cam-proxy --host 192.168.5.1 --mac 00:40:7F:8B:E2:AF --cert client.pem --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx rtsp -s rtsp://admin:[email protected]:554/cam/realmonitor?channel=1
pi@raspberrypi:~ $ 2021-03-01 22:21:39 raspberrypi RTSPCam[2722] INFO /tmp/tmp8hYEVR
2021-03-01 22:21:39 raspberrypi RTSPCam[2722] INFO ffmpeg -y -re -rtsp_transport tcp -i "rtsp://admin:[email protected]:554/cam/realmonitor?channel=1" -vf fps=1 -update 1 /tmp/tmp8hYEVR/screen.jpg
2021-03-01 22:21:39 raspberrypi Core[2722] INFO Creating ws connection to wss://192.168.5.1:7442/camera/1.0/ws?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Traceback (most recent call last):
File "/usr/local/bin/unifi-cam-proxy", line 10, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/unifi/main.py", line 58, in main
c.run()
File "/usr/local/lib/python2.7/dist-packages/unifi/core.py", line 745, in run
ws = websocket.create_connection(uri, sslopt=ssl_opts, header=headers)
File "/usr/local/lib/python2.7/dist-packages/websocket/_core.py", line 515, in create_connection
websock.connect(url, **options)
File "/usr/local/lib/python2.7/dist-packages/websocket/_core.py", line 226, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/usr/local/lib/python2.7/dist-packages/websocket/_handshake.py", line 80, in handshake
status, resp = _get_resp_headers(sock)
File "/usr/local/lib/python2.7/dist-packages/websocket/_handshake.py", line 165, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers)
websocket._exceptions.WebSocketBadStatusException: Handshake status 403 Forbidden

not to sure if I'm doing something wrong or script no designed for this hardware.

Hikvision DS-2DE3304W-DE and Raspberry Pi4B install guide for noob's like me (Recording problem solved)

Problem Solved in Hikvision DS-2DE3304W-DE camera settings

I followed the instructions to build an OS on a Raspberry Pi 4B/4GB.
I get 720P or 1280P video running on the UDMP Protect user interface.
I can control the PZT functions brightness/contrast settings
I tried to make changes in the UDMP user interface to record. But nothing records.
Any assistance you can provide is greatly appreciated. Jeff

Command run on the Raspberry Pi:
unifi-cam-proxy -H 192.168.XX.1 -i 192.168.10.ZZ -c client.pem -t IwRIWhNS0sABCDET1kiI5NeA18SQOGXXX hikvision -u admin -p XYZWda! (Am I missing any additional options on the command line to record?)

step by step installation

Hi,

I am not sure that I completely understand process. Token is in camera directly or in unifi protect device? In my case cloud key g2+. I have 2 hikvison cameras and would love to add to unifi protect.

Is it possible to make step by step process?

Juraj

Unifi Protect app crashes (iOS and tvOS)

After following the setup guide I am able to view the live steam of my IP camera from the Unifi Protect web app. So next I tested the iOS and tvOS app. I can see the live feed from the "thumbnail" view of cameras but when I open one of the cameras to go "fullscreen" the apps crash.

Framerate issues

Recently got this going with 6 Dahua cameras, IPC-HFW1420S, or similar. H264 codec, using 4096 bitrate, which is the highest I can go using rtsp, and a resolution 2688x1520.

For the most part its fine, but the camera will freeze when there is motion, and it isn't necessarily due to fast moving objects... happens when kids are walking, but may not happen when they shoot an arrow, etc. This could be the RTSP stream, and not the software, but figured I'd bring it up to see if there is anything that can be tweaked without losing quality.

The network is 1GB, and all of the cameras, machine running unifi-cam-proxy, and NVR are on its own POE switch. The linux box running Unifi-cam-proxy is the latest release of debian and is fairly beefy... 16GB ram, and a Ryzen 5 Pro 2500, with nothing else going on on the machine, and an SSD.

refusing to connect to nvr

Hey, I have a Dahua camera system (Dahua nvr and cameras) and a unifi camera system and I've gone through and set up but when I run the command unifi-cam-proxy --host 192.168.1.204 --cert client.pem --token RLnFcdeMiqgSUPTpTsd0ISY3bdUf6vgj rtsp -s rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0
it spits out:
Traceback (most recent call last):
File "/home/toby/.local/bin/unifi-cam-proxy", line 8, in
sys.exit(main())
File "/home/toby/.local/lib/python3.8/site-packages/unifi/main.py", line 104, in main
loop.run_until_complete(c.run())
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/toby/.local/lib/python3.8/site-packages/unifi/core.py", line 67, in run
await connect()
File "/home/toby/.local/lib/python3.8/site-packages/backoff/_async.py", line 66, in retry
ret = await target(*args, **kwargs)
File "/home/toby/.local/lib/python3.8/site-packages/unifi/core.py", line 43, in connect
ws = await websockets.connect(
File "/home/toby/.local/lib/python3.8/site-packages/websockets/legacy/client.py", line 622, in await_impl
transport, protocol = await self._create_connection()
File "/usr/lib/python3.8/asyncio/base_events.py", line 1025, in create_connection
raise exceptions[0]
File "/usr/lib/python3.8/asyncio/base_events.py", line 1010, in create_connection
sock = await self._connect_sock(
File "/usr/lib/python3.8/asyncio/base_events.py", line 924, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/lib/python3.8/asyncio/selector_events.py", line 494, in sock_connect
return await fut
File "/usr/lib/python3.8/asyncio/selector_events.py", line 526, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.1.204', 7442)

Is there anything that I've missed?

Using without unifi camera

Hi! So I have a dream machine in my home and I love it, I use the Network and Access applications and looking into protect. I don't want to replace my existing cameras or buy any Unifi ones and the blue iris UI looks like it is from the 1980s... Protect on the other hand has a modern, simple and esay to use while being functional at the same time. I am not sure how to get a token though. Does any1 know how to do that and or specific instructions for UDMP?

Discussion: Single stream from camera

(This is more of a discussion than an issue / bug report.)

Would it be possible to connect to the camera with only a single stream? My doorbell cam seems to become overwhelmed by the multiple connections.

Can ffmpeg be run in a way to connect once and then re-stream 3x instead of connecting 3x?

Issues starting docker on unraid

I believe I've configured the docker correctly, I'm attempting to start it with the test RTSP stream, I'm getting the below errors in the logs, any pointers as to what I might be doing wrong? Do I need to set some additional Network settings (ports?) for the docker container?

log:
2021-07-16 14:32:58 78519db87c4f RTSPCam[1] INFO Spawning stream for snapshots: ffmpeg -nostdin -y -re -rtsp_transport tcp -i "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov" -vf fps=1 -update 1 /tmp/tmpkvn6fj5o/screen.jpg
2021-07-16 14:32:58 78519db87c4f Core[1] INFO Creating ws connection to wss://192.1681.1:7442/camera/1.0/ws?token=ueTHW7Wxenx69CUhL0qV7qswLoUSzpxP
Traceback (most recent call last):
File "/usr/local/bin/unifi-cam-proxy", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/unifi/main.py", line 104, in main
loop.run_until_complete(c.run())
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
return future.result()
File "/usr/local/lib/python3.7/site-packages/unifi/core.py", line 67, in run
await connect()
File "/usr/local/lib/python3.7/site-packages/backoff/_async.py", line 66, in retry
ret = await target(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/unifi/core.py", line 47, in connect
subprotocols=["secure_transfer"],
File "/usr/local/lib/python3.7/site-packages/websockets/legacy/client.py", line 622, in await_impl
transport, protocol = await self._create_connection()
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 913, in create_connection
type=socket.SOCK_STREAM, proto=proto, flags=flags, loop=self)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1290, in _ensure_resolved
proto=proto, flags=flags)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 792, in getaddrinfo
None, getaddr_func, host, port, family, type, proto, flags)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/socket.py", line 752, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

Smart detection with Frigate

Hi! Thank you so much for your work.

What are the instructions to get the smart detections with frigate? I have a frigate installation with usb TPU and it works well and it would be great to integrate in an udmpro with protect.

I try to put the frigate rtmp url in the rtsp url of the proxy, but it not works. I'm triying in docker installation.

Won't record

First this is a fantastic project and really appreciate it had some issues getting the python to work but i have the docker working.
Currently i am using an RTSP link and able to view the camera in mu unifi video dashboard however the IP address is incorrect(not even the right subnet), and even though i have recording on, the footage is not recording.

Any advice would be greatly appreciated.

New Install - Error When Running

Hi everyone,

I have a new installation, running Ubuntu 20.04.2 LTS (Linux 5.8.0-53-generic x86_64), I get the following error as soon as I try to run unifi-cam-proxy:

user@plex:~$ ~/.local/bin/unifi-cam-proxy --host 192.168.1.16 --cert ~/.local/bin/client.pem --token xxxxxxxxxxxxxxxxx --verbose
Traceback (most recent call last):
  File "/home/user/.local/bin/unifi-cam-proxy", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.8/site-packages/unifi/main.py", line 84, in main
    klass = CAMS[args.impl]
KeyError: None

user@plex:~$ ~/.local/bin/unifi-cam-proxy --version
0.1.2

I'm probably doing something wrong but don't know where to begin. Can anyone please help?

Thanks!

Frigate Smart Detections Stop Working

I have Frigate installed through HomeAssistant and person/object detection works perfectly there. UniFi sees the smart detections and they show up with the neat little yellow bounding boxes too. For some reason the smart detections in UniFi Protect periodically stop working and the only fix seems to be to restart the unifi-cam-proxy stream. Smart detections will start working again for a little while and then randomly stop again. I have two FOSCAM cameras configured with RTSP streams as follows:

unifi-cam-proxy -H 192.168.1.1 -i 192.168.1.16 --mac 'AA:BB:CC:00:11:21' -c client.pem -t xxxx frigate -s rtsp://user:[email protected]:80/videoSub --ffmpeg-args '-c:v copy -vbsf "h264_metadata=tick_rate=2206/100:fixed_frame_rate_flag=1" -ar 32000 -ac 2 -codec:a aac -b:a 32k' --mqtt-host 192.168.1.20 --frigate-camera Downstairs

unifi-cam-proxy  -H 192.168.1.1 -i 192.168.1.17  --mac 'AA:BB:CC:00:11:22' -c client.pem -t xxxx frigate -s rtsp://user:[email protected]:80/videoSub --ffmpeg-args '-c:v copy -vbsf "h264_metadata=tick_rate=2206/100:fixed_frame_rate_flag=1" -ar 32000 -ac 2 -codec:a aac -b:a 32k' --mqtt-host 192.168.1.20 --frigate-camera Upstairs

Frigate continues seeing the person/object detections even after they stop showing up in UniFi. The video continues recording in UniFi Protect and I can still view live. JUST the smart detections stop working.

Any thoughts?

USB Webcam

Do you know of an easy way to do this with a simple USB webcam?
thank you

Only initial still image instead of live video

I'm trying to connect rtsp camera stream but getting only still initial image instead of realtime video than it get black. I tried local install and also docker image with same result, any suggestions? In verbose logging i can't see anything strange, but if need i can share logs.

Errors unsure of what to do apologies Noob

Hi I have a Dream Machine Pro running Unifi Protect v 1.19.0-beta.15 with a Hikvision DS-2CD2385FWD-I running fw V5.6.4 build 191224

My installation is a Parpberry pi 4B 8Gb running Raspberry Pi OS latest and updated,

Python is v3.7.3

My installation was native using pip install unifi-cam-proxy

after installation I was reading others install and they seem to have the installation folder in .local/lib/python3.7 but mine is .local/lib/python2.7

I ran the following and got waht I have pasted below. I have added all IP Cameras to the allow list in the firewall

pi@pi-homelab:~ $ unifi-cam-proxy -H 10.0.3.1 -i 10.0.3.51 -c /home/pi/client.pem -t ZnVeJnLu2MHNYznj7LQi7pqIvKJIiTDa hikvision -u admin -p PASSWORD
2021-06-25 22:27:25 pi-homelab urllib3.connectionpool[1452] DEBUG Starting new HTTP connection (1): 10.0.3.51:80
2021-06-25 22:27:25 pi-homelab urllib3.connectionpool[1452] DEBUG http://10.0.3.51:80 "GET /ISAPI/System/status HTTP/1.1" 200 1438
2021-06-25 22:27:25 pi-homelab Core[1452] INFO Creating ws connection to wss://10.0.3.1:7442/camera/1.0/ws?token=ZnVeJnLu2MHNYznj7LQi7pqIvKJIiTDa
2021-06-25 22:27:25 pi-homelab Core[1452] INFO Initiating adoption with token [ZnVeJnLu2MHNYznj7LQi7pqIvKJIiTDa] and mac [44D9E7407670]
2021-06-25 22:27:25 pi-homelab Core[1452] DEBUG Sending: {'from': 'ubnt_avclient', 'functionName': 'ubnt_avclient_hello', 'inResponseTo': 0, 'to': 'UniFiVideo', 'responseExpected': False, 'messageId': 1, 'payload': {'connectionHost': '10.0.3.1', 'connectionSecurePort': 7442, 'rebootTimeoutSec': 30, 'name': 'unifi-cam-proxy', 'adoptionCode': 'ZnVeJnLu2MHNYznj7LQi7pqIvKJIiTDa', 'idleTime': 191.96, 'protocolVersion': 67, 'mac': '44D9E7407670', 'uptime': 0.030469894409179688, 'fwVersion': 'UVC.S2L.v4.14.14.67.037e886.190630.1017', 'semver': 'v4.4.8', 'ip': '10.0.3.51', 'upgradeTimeoutSec': 150, 'model': 'UVC G3', 'hwrev': 19, 'totalLoad': 0.5474}}
2021-06-25 22:27:25 pi-homelab Core[1452] INFO Processing [ubnt_avclient_hello] message
2021-06-25 22:27:25 pi-homelab Core[1452] DEBUG Message contents: {u'from': u'UniFiVideo', u'functionName': u'ubnt_avclient_hello', u'inResponseTo': 1, u'to': u'ubnt_avclient', u'messageId': 15830, u'payload': {u'controllerUuid': u'c7ea0e26-86cb-488e-a7ba-990c622ba8e9', u'overrideUuid': True, u'controllerName': u'Dream Machine Pro', u'controllerVersion': u'1.19.0-beta.15', u'protocolVersion': 67}}
Traceback (most recent call last):
File "/home/pi/.local/bin/unifi-cam-proxy", line 10, in
sys.exit(main())
File "/home/pi/.local/lib/python2.7/site-packages/unifi/main.py", line 58, in main
c.run()
File "/home/pi/.local/lib/python2.7/site-packages/unifi/core.py", line 759, in run
reconnect = self.process(ws, msg)
File "/home/pi/.local/lib/python2.7/site-packages/unifi/core.py", line 666, in process
if m["responseExpected"] == False and m["functionName"] not in [
KeyError: 'responseExpected'

[Feature Request] Unraid Docker Image Support

(Sorry for the wild edits, hitting enter on accident submits the topic)

Please define a docker template for Unraid or list all of the port requirements for the docker image so one can be defined.

Nest camera support

I know what you are going to say, BUT NEST CAMS ARENT RTSP I know, but they are m3u8 hls and you can get the links. But if I put in my nest cam hls m3u8 link, it can’t connect however vlc can do it and blue iris can do it and agent can do it and ffmpeg can do it. I think it is a matter of support that type of input. If you don’t have a nest camera and would like to learn how the links are generated please tell me, we can work together. But in general nest cameras work on the hls m3u8 protacal and there links looks somthing like this: https://stream-eu1-charlie.dropcam.com/nexus_aac/XXXXXX/chunklist_XXXX.m3u8?public=XXXXX

Help with Unifi-cam-proxy on Raspberry Pi 4B 8GB and Hikvision DS-2DE3304W-DE

Hi,

I hope I don't upset anyone with my inexperience with questions in this format.
I have been struggling on my own and not have been successful in setting up unifi-cam-proxy on a Raspberry Pi 4B 8GB with a Hikvision DS-2DE3304W-DE.

  1. Installed most current Raspberry Pi image to boot and SSH remotely for software install.
  2. Installed ffmpeg : sudo apt install ffmpeg
  3. Installed Netcat : sudo apt-get install mplayer netcat
  4. Setup Python to default to 3.7 : https://www.youtube.com/watch?v=_DI0jgnrDVc
  5. Generated the client.pem from the instruction "create your own client certificate" placed on the PI O/S directory.
  6. Generate a token from the instructions (see below with token with XXXX).

Results below.

pi@raspberrypi:~ $ unifi-cam-proxy -H 192.168.10.1 -i 192.168.10.64 -c client.pem -t XXXXASPsOG8XOHWwENIpaxcXXXXj hikvision -u admin -p 91Honda!
2021-06-23 16:35:11 raspberrypi urllib3.connectionpool[2200] DEBUG Starting new HTTP connection (1): 192.168.10.64:80
2021-06-23 16:35:11 raspberrypi urllib3.connectionpool[2200] DEBUG http://192.168.10.64:80 "GET /ISAPI/System/status HTTP/1.1" 401 178
2021-06-23 16:35:11 raspberrypi urllib3.connectionpool[2200] DEBUG http://192.168.10.64:80 "GET /ISAPI/System/status HTTP/1.1" 401 178
2021-06-23 16:35:11 raspberrypi urllib3.connectionpool[2200] DEBUG http://192.168.10.64:80 "GET /ISAPI/System/status HTTP/1.1" 200 1449
2021-06-23 16:35:11 raspberrypi Core[2200] INFO Creating ws connection to wss://192.168.10.1:7442/camera/1.0/ws?token=FjWFASPsOG8XOHWwENIpaxcPawTwtOj
Traceback (most recent call last):
File "/home/pi/.local/bin/unifi-cam-proxy", line 10, in
sys.exit(main())
File "/home/pi/.local/lib/python2.7/site-packages/unifi/main.py", line 58, in main
c.run()
File "/home/pi/.local/lib/python2.7/site-packages/unifi/core.py", line 745, in run
ws = websocket.create_connection(uri, sslopt=ssl_opts, header=headers)
File "/home/pi/.local/lib/python2.7/site-packages/websocket/_core.py", line 594, in create_connection
websock.connect(url, **options)
File "/home/pi/.local/lib/python2.7/site-packages/websocket/_core.py", line 253, in connect
self.handshake_response = handshake(self.sock, *addrs, **options)
File "/home/pi/.local/lib/python2.7/site-packages/websocket/_handshake.py", line 79, in handshake
status, resp = _get_resp_headers(sock)
File "/home/pi/.local/lib/python2.7/site-packages/websocket/_handshake.py", line 165, in _get_resp_headers
raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers)
websocket._exceptions.WebSocketBadStatusException: Handshake status 403 Forbidden

Is it possible someone could provide a working Pi4B image with Hikvision DS-2DE3304W-DE "run" line without their token?

Thank you in advance!

Jeff

Reolink Problem

Hi all, i'm tring to make the proxy work with reolink cameras (direct connection) or via the NVR.

If i connect via the standard rstp protocol the stream remains black. The rstp link is ok and working in VLC: rtsp://admin:password@ip_address:554//h264Preview_01_main

If i use the reolink_nvr option i'm able to get an image but it still freezed to the first frame....

any suggestion?

Node port / Add instructions for installing and running

Hi!

Absolutely love the idea behind this repo. Been thinking about how I can accomplish the same and then i stumbled accross this.

I'm having some real problems getting this to run in ubuntu. I'm trying to pass my RTSP cameras to Unifi Video running on the same ubuntu instance.
What are the expected install instruction so that i'm clear (python isn't my first language)

I've tried:
pip install .
python setup.py install

I've not had much luck thus far

I'd also be interested if there is a way we could build in extra params on the end of the rtsp url (it may already be supported)
i.e.: user=admin&password=342324

Thanks in advance!

Update 26/04/2020:
I've made some headway into porting this to node - can't thank you enough for the inspiration. I've managed to get the fake camera to pop up in the NVR, having some problems with adoption. Would be great to sync up and discuss how you achieved this.

Stream Transport stops after roughly a day

Having sucessfully connected 4 Dahua Cameras to the UDM Pro I am facing an issue where the video stream to the UDM PRO stops after roughly 20-24 hours while the unifi-cam-proxy tool still is running without any noticeable error message.
htop shows the correct amount of ffmpeg sessions but no image is being delivered to the UDM PRO.
The cameras are marked as "online" in the unifi protect app but no live feed can be shown and no recording is available.

Restarting the unifi-cam-proxy process resumes operation immediately. sometimes i have days of uninterrupted service, then one cam fails, sometimes all cams fail.

Right now one of four cams has failed about 8 hours ago. htop lists the following processes for this cams ip:

/bin/sh -c ffmpeg -nostdin -y -rtsp_transport tcp -i "rtsp://XXX:[email protected]:554" -c:v copy -c:a copy -metadata streamname=GNkzuUYLpPGrxEcJ -f flv - | /usr/bin/python3.8 -m unifi.clock_sync | nc 192.168.0.254 7550
/bin/sh -c ffmpeg -nostdin -y -rtsp_transport tcp -i "rtsp://XXX:[email protected]:554" -c:v copy -c:a copy -metadata streamname=HccAamgW2TSarR7U -f flv - | /usr/bin/python3.8 -m unifi.clock_sync | nc 192.168.0.254 7550
/bin/sh -c ffmpeg -nostdin -y -rtsp_transport tcp -i "rtsp://XXX:[email protected]:554" -c:v copy -c:a copy -metadata streamname=XqqOr6vKvFzmMYRn -f flv - | /usr/bin/python3.8 -m unifi.clock_sync | nc 192.168.0.254 7550
ffmpeg -nostdin -y -rtsp_transport tcp -i rtsp://XXX:[email protected]:554 -c:v copy -c:a copy -metadata streamname=GNkzuUYLpPGrxEcJ -f flv -
ffmpeg -nostdin -y -rtsp_transport tcp -i rtsp://XXX:[email protected]:554 -c:v copy -c:a copy -metadata streamname=XqqOr6vKvFzmMYRn -f flv -
ffmpeg -nostdin -y -re -rtsp_transport tcp -i rtsp://XXX:[email protected]:554 -vf fps=1 -update 1 /tmp/tmplmr1z60e/screen.jpg
ffmpeg -nostdin -y -rtsp_transport tcp -i rtsp://XXX:[email protected]:554 -c:v copy -c:a copy -metadata streamname=HccAamgW2TSarR7U -f flv -

In the "timelapse" view in unifi protect the camera area shows "Camera settings updated" with a red excalmation mark.

Noticeably the ffmpeg screenshot process hangs with zero CPU usage. Killing off the ffpmeg processes with the kill command resumes camera operation in unifi protect without the need to restart unifi-cam-proxy.

Can anyone please help to troubleshoot this? Is this a memory problem?

Also: can we provide a screenshot to unifiprotect with a dedicated jpeg url instead of the ffmpeg thingy? :-)

Thanks!! 👍

Wyze rtsp + protect kills mobile app

Everything went swimmingly and the Wyze V2 cam works perfectly in the web (slow, but expected).

When I open the mobile Protect app, I can see both my ubiquiti cam and my wyze cam, but when I open the wyze cam, the app dies. Then it continues to die until I unplug the camera, start the app, and go back to the monitor screen that shows all the cameras.

Thoughts? Any logs that might help?

Live view not working

Hey y'all,

today I tried setting up the proxy server. I have two Reolink cameras. I tried the command for the Reolink NVR and also the "normal" RTSP command as mentioned in the readme. When I look into the protect interface I can see snapshots in the "About" section. However, live view/streaming won't work. I can hear the live audio, but the video feed is stuck on one frame. I read through a bunch of different issues, tried setting the Reolink H264 Profile to "base" and some other tips I read, but nothing seems to fix my issue.
Do you have any ideas/suggestions? Can you please help me out?

//Edit: The BigBuckBunny (Readme) stream works flawless... it's just my cameras that won't work. Btw: resolution is 2560x1920. Does that make a difference? The g3's are 1920x1080 iirc

hikvision issue

when i try to import camera, it looks like:

Screenshot 2021-04-28 at 6 15 22

in unifi protect:
Screenshot 2021-04-28 at 6 15 52

PIP install command fails

root@unifi-nvr:~# pip install unifi-cam-proxy
Collecting unifi-cam-proxy
Downloading https://files.pythonhosted.org/packages/10/17/971113610369d21c5e0e61fa420bd5a35d4ab49b38c229a3ed0c467ab1dc/unifi-cam-proxy-0.0.3.tar.gz
Running setup.py (path:/tmp/pip-build-VlS1fG/unifi-cam-proxy/setup.py) egg_info for package unifi-cam-proxy produced metadata for project name unknown. Fix your #egg=unifi-cam-proxy fragments.
Building wheels for collected packages: unknown, unknown
Running setup.py bdist_wheel for unknown ... done
Stored in directory: /root/.cache/pip/wheels/5d/2b/76/a87242ac9eca3194aa77429c1de246a208203a0fb87457a9bd
Running setup.py bdist_wheel for unknown ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-VlS1fG/unknown/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" bdist_wheel -d /tmp/tmpvvjBz7pip-wheel- --python-tag cp27:
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 2] No such file or directory: '/tmp/pip-build-VlS1fG/unknown/setup.py'


Failed building wheel for unknown
Running setup.py clean for unknown
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-VlS1fG/unknown/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" clean --all:
Traceback (most recent call last):
File "", line 1, in
IOError: [Errno 2] No such file or directory: '/tmp/pip-build-VlS1fG/unknown/setup.py'


Failed cleaning build dir for unknown
Successfully built unknown
Failed to build unknown
Installing collected packages: unknown
Successfully installed unknown-0.0.0
You are using pip version 8.1.1, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Fanvil i32 doorphone live view not working

Hi all,
i've a Fanvil i32V doorphone that have 2 rtsp streams.
I've successfully added the cam by unifi-cam-proxy and i can see the image preview on my unifi protect NVR but live view does not work.
i tried to change some rtsp streaming setting, using different ffmpeg arguments and different substream but nothing works.

The preview image refresh every 3-5 seconds but live view does not working.

i use unifi-cam-proxy on windows 10
These are the Fanvil doorphone setting that i can change:

fanvil

Protect preview:
preview

Thanks in advance for support

Motion detection not working

It doesn't appear that anything I'd being detected even though I know there had been movement, is there something that I'm missing?

[Info] Working Camera Models

Hi,

First of all: Thanks to the author of this software! Maybe we can have a list of working camera models.

  • Yi Home 1080p Ai+ with YiHack Firmware

UniFi Video feed jumps on RTSP

I am currently using this along with an RTSP hack for a Xiaomi camera. The live view and recording on UniFi Video is laggy and jumps back and forwards.

I have tested the RTSP feed on VLC and all is smooth. Is this a common issue or my hardware?
Both my UniFi Video and proxy is on a 1gbps network. The security camera is on Wi-Fi 2.4g

Can I use this software to also save the stream?

Hey dev, thanks so much for your work on this. Please put up a donate button when you get a chance!
I am still in the research phase, but trying to make the most of the hardware I own already.

I have UDM Pro, few Unify cameras and some 3rd party cameras. I have a NAS with 24TB of storage that runs docker. I want to run this in my NAS but also while it is serving the content to my UDM Pro, I want it to also save the footage (NVR style) of the cameras because UDM Pro doesnt let me use my nas as storage (unless it does?)

Is this possible? If not, do you know if I can use other software to make it possible?

Thanks

UDM Pro

Hi, is this proxy compatible with Unifi Protect on UDM Pro?

Connection is already closed

Hi,

do you have any hint for me with the following error message?

Traceback (most recent call last): File "/usr/local/bin/unifi-cam-proxy", line 10, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/unifi/main.py", line 58, in main c.run() File "/usr/local/lib/python2.7/dist-packages/unifi/core.py", line 745, in run ws = websocket.create_connection(uri, sslopt=ssl_opts, header=headers) File "/usr/local/lib/python2.7/dist-packages/websocket/_core.py", line 592, in create_connection websock.connect(url, **options) File "/usr/local/lib/python2.7/dist-packages/websocket/_core.py", line 252, in connect self.handshake_response = handshake(self.sock, *addrs, **options) File "/usr/local/lib/python2.7/dist-packages/websocket/_handshake.py", line 79, in handshake status, resp = _get_resp_headers(sock) File "/usr/local/lib/python2.7/dist-packages/websocket/_handshake.py", line 162, in _get_resp_headers status, resp_headers, status_message = read_headers(sock) File "/usr/local/lib/python2.7/dist-packages/websocket/_http.py", line 308, in read_headers line = recv_line(sock) File "/usr/local/lib/python2.7/dist-packages/websocket/_socket.py", line 134, in recv_line c = recv(sock, 1) File "/usr/local/lib/python2.7/dist-packages/websocket/_socket.py", line 126, in recv "Connection is already closed.") websocket._exceptions.WebSocketConnectionClosedException: Connection is already closed.

Many thanks!

Unifi Protect Dream Machine Pro

Hi,

thanks for the that nice piece of software.

I have some trouble to adopt a camera, because I cant create an adoption token in the Unifi protect settings / dashboard, there is no option to generate or show a token.
Bildschirmfoto 2020-09-14 um 11 00 33

If I run the command at the first time:
unifi-cam-proxy --host 192.168.XXX.1 --cert client.pem --mac 'AA:BB:CC:00:11:22' --verbose --token '' rtsp -s rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov

I get this message:
2020-09-14 11:05:29 unifi-camera-proxy RTSPCam[936] INFO /tmp/tmp93ukHV 2020-09-14 11:05:29 unifi-camera-proxy RTSPCam[936] INFO ffmpeg -y -re -rtsp_transport tcp -i "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov" -vf fps=1 -update 1 /tmp/tmp93ukHV/screen.jpg 2020-09-14 11:05:29 unifi-camera-proxy Core[936] INFO Creating ws connection to wss://192.168.XXX.1:7442/camera/1.0/ws?token= Traceback (most recent call last): File "/usr/local/bin/unifi-cam-proxy", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/unifi/main.py", line 58, in main c.run() File "/usr/local/lib/python2.7/dist-packages/unifi/core.py", line 745, in run ws = websocket.create_connection(uri, sslopt=ssl_opts, header=headers) File "/usr/local/lib/python2.7/dist-packages/websocket/_core.py", line 515, in create_connection websock.connect(url, **options) File "/usr/local/lib/python2.7/dist-packages/websocket/_core.py", line 226, in connect self.handshake_response = handshake(self.sock, *addrs, **options) File "/usr/local/lib/python2.7/dist-packages/websocket/_handshake.py", line 80, in handshake status, resp = _get_resp_headers(sock) File "/usr/local/lib/python2.7/dist-packages/websocket/_handshake.py", line 165, in _get_resp_headers raise WebSocketBadStatusException("Handshake status %d %s", status, status_message, resp_headers) websocket._exceptions.WebSocketBadStatusException: Handshake status 403 Forbidden

Now I can manually adopt the camera at the Dashboard:
Bildschirmfoto 2020-09-14 um 11 06 42
Bildschirmfoto 2020-09-14 um 11 08 10

Now I run the same command a second time
unifi-cam-proxy --host 192.168.XXX.1 --cert client.pem --mac 'AA:BB:CC:00:11:22' --verbose --token '' rtsp -s rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov

I get this message:
2020-09-14 11:12:00 unifi-camera-proxy RTSPCam[981] INFO /tmp/tmpwKcKgZ 2020-09-14 11:12:00 unifi-camera-proxy RTSPCam[981] INFO ffmpeg -y -re -rtsp_transport tcp -i "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_175k.mov" -vf fps=1 -update 1 /tmp/tmpwKcKgZ/screen.jpg 2020-09-14 11:12:00 unifi-camera-proxy Core[981] INFO Creating ws connection to wss://192.168.XXX.1:7442/camera/1.0/ws?token= 2020-09-14 11:12:01 unifi-camera-proxy Core[981] INFO Initiating adoption with token [] and mac [AA:BB:CC:00:11:22] 2020-09-14 11:12:01 unifi-camera-proxy Core[981] DEBUG Sending: {'from': 'ubnt_avclient', 'functionName': 'ubnt_avclient_hello', 'inResponseTo': 0, 'to': 'UniFiVideo', 'responseExpected': False, 'messageId': 1, 'payload': {'connectionHost': '192.168.XXX.1', 'connectionSecurePort': 7442, 'rebootTimeoutSec': 30, 'name': 'unifi-cam-proxy', 'adoptionCode': '', 'idleTime': 191.96, 'protocolVersion': 67, 'mac': 'AA:BB:CC:00:11:22', 'uptime': 0.04075288772583008, 'fwVersion': 'UVC.S2L.v4.14.14.67.037e886.190630.1017', 'semver': 'v4.4.8', 'ip': '192.168.1.10', 'upgradeTimeoutSec': 150, 'model': 'UVC G3', 'hwrev': 19, 'totalLoad': 0.5474}} 2020-09-14 11:12:01 unifi-camera-proxy Core[981] INFO Processing [ubnt_avclient_hello] message 2020-09-14 11:12:01 unifi-camera-proxy Core[981] DEBUG Message contents: {u'from': u'UniFiVideo', u'functionName': u'ubnt_avclient_hello', u'inResponseTo': 1, u'to': u'ubnt_avclient', u'messageId': 11280, u'payload': {u'controllerName': u'unifi', u'overrideUuid': True, u'protocolVersion': 67}} Traceback (most recent call last): File "/usr/local/bin/unifi-cam-proxy", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python2.7/dist-packages/unifi/main.py", line 58, in main c.run() File "/usr/local/lib/python2.7/dist-packages/unifi/core.py", line 759, in run reconnect = self.process(ws, msg) File "/usr/local/lib/python2.7/dist-packages/unifi/core.py", line 666, in process if m["responseExpected"] == False and m["functionName"] not in [ KeyError: 'responseExpected'

In the message I found a IP that not belongs to me "192.168.1.10", I found out this is the default camera ip, I dont use this option, because I connect to my cam directly to the rtsp stream like the bunny video.

Please help! What can i Do to get this working?

Reolink Standalone - Issue

Trying this out with a Reolink camera and I'm getting the following error each time:

I have Python 2.7 installed.

kieran@homeserver:~$ unifi-cam-proxy -H 192.168.0.1 -i 192.168.0.8 -c client.pem -t cm7joIvEgG2t5zsA8Z9JHt1KNVAgFRmf rtsp -s rtsp://admin:[email protected]:554//h264Preview_01_main --ffmpeg-args '-c:v copy -vbsf "h264_metadata=tick_rate=60000/1001:fixed_frame_rate_flag=1" -ar 32000 -ac 2 -codec:a aac -b:a 32k'
2021-06-13 14:21:22 homeserver RTSPCam[5639] INFO /tmp/tmpc5I9uo
2021-06-13 14:21:22 homeserver RTSPCam[5639] INFO ffmpeg -y -re -rtsp_transport tcp -i "rtsp://admin:[email protected]:554//h264Preview_01_main" -vf fps=1 -update 1 /tmp/tmpc5I9uo/screen.jpg
2021-06-13 14:21:22 homeserver Core[5639] INFO Creating ws connection to wss://192.168.0.1:7442/camera/1.0/ws?token=cm7joIvEgG2t5zsA8Z9JHt1KNVAgFRmf
2021-06-13 14:21:22 homeserver Core[5639] INFO Initiating adoption with token [cm7joIvEgG2t5zsA8Z9JHt1KNVAgFRmf] and mac [44D9E7407670]
2021-06-13 14:21:22 homeserver Core[5639] DEBUG Sending: {'from': 'ubnt_avclient', 'functionName': 'ubnt_avclient_hello', 'inResponseTo': 0, 'to': 'UniFiVideo', 'responseExpected': False, 'messageId': 1, 'payload': {'connectionHost': '192.168.0.1', 'connectionSecurePort': 7442, 'rebootTimeoutSec': 30, 'name': 'unifi-cam-proxy', 'adoptionCode': 'cm7joIvEgG2t5zsA8Z9JHt1KNVAgFRmf', 'idleTime': 191.96, 'protocolVersion': 67, 'mac': '44D9E7407670', 'uptime': 0.022231101989746094, 'fwVersion': 'UVC.S2L.v4.14.14.67.037e886.190630.1017', 'semver': 'v4.4.8', 'ip': '192.168.0.8', 'upgradeTimeoutSec': 150, 'model': 'UVC G3', 'hwrev': 19, 'totalLoad': 0.5474}}
2021-06-13 14:21:22 homeserver Core[5639] INFO Processing [ubnt_avclient_hello] message
2021-06-13 14:21:22 homeserver Core[5639] DEBUG Message contents: {u'from': u'UniFiVideo', u'functionName': u'ubnt_avclient_hello', u'inResponseTo': 1, u'to': u'ubnt_avclient', u'messageId': 10010, u'payload': {u'controllerUuid': None, u'overrideUuid': True, u'controllerName': u'Dream Machine', u'controllerVersion': u'1.18.1', u'protocolVersion': 67}}
Traceback (most recent call last):
  File "/home/kieran/.local/bin/unifi-cam-proxy", line 11, in <module>
    sys.exit(main())
  File "/home/kieran/.local/lib/python2.7/site-packages/unifi/main.py", line 58, in main
    c.run()
  File "/home/kieran/.local/lib/python2.7/site-packages/unifi/core.py", line 759, in run
    reconnect = self.process(ws, msg)
  File "/home/kieran/.local/lib/python2.7/site-packages/unifi/core.py", line 666, in process
    if m["responseExpected"] == False and m["functionName"] not in [
KeyError: 'responseExpected'

Example of Docker run

Hi, I am being a noob.
I am installed the prererqs and I am trying to get this working on a Container but I am getting this message.
xxxx@unbutu:~$ sudo docker run --rm -v "/home/xxxxx:/client.pem" keshavdv/unifi-cam-proxy unifi-cam-proxy --verbose --ip "x.x.x.x" --host x.x.x.x --mac 'AA:BB:CC:00:11:22' --cert client.pem --token xxxxxxxxxxxxxx rtsp -s rtsp://x.x.x.x
Traceback (most recent call last):
File "/usr/local/bin/unifi-cam-proxy", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/unifi/main.py", line 101, in main
cam = klass(args, logger)
File "/usr/local/lib/python3.7/site-packages/unifi/cams/rtsp.py", line 14, in init
super().init(args, logger)
File "/usr/local/lib/python3.7/site-packages/unifi/cams/base.py", line 48, in init
self._ssl_context.load_cert_chain(args.cert, args.cert)
IsADirectoryError: [Errno 21] Is a directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.