keshavdv / unifi-cam-proxy

Enable non-Ubiquiti cameras to work with Unifi NVR
MIT License
1.65k stars 230 forks source link

Adding a Remote Camera #121

Closed edavrio closed 2 years ago

edavrio commented 2 years ago

Hi guys.

So I am trying to add a remote camera over WAN, meaning the NVR and the Camera are not in the same network. Everything is working except the recording/live feature and this is because it connects to a default port.

I am running with these options: unifi-cam-proxy --host IP -i IP:8081 --mac '08:a1:89:92:74:c9' --cert client.pem --token 238482h34jj2 hikvision -u admin -p Som3PasS

In Unifi-Video itself I see the camera but when I try to view it Live or set it up I get: INFO Spawning ffmpeg for video2 (wt7S2_08A1899274C9_1): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:Som3PasS@IP:8081:554/Streaming/Channels/3/" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=wt7S2_08A1899274C9_1 -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc NVR-IP 6666

So it is connecting to rtsp://admin:Som3PasS@IP:8081:554 which is not OK ) Is there a way to change the default RTSP port to another one? Because I am using NAT so the port is 10554. The reason I need this option is because there are 4 cameras there, so I cant just map 554 and 80 from Hikvision to WAN IP, because it will only make one camera to work.

Any input is highly appreciated. Thanks.

Later add Maybe adding a parameter like --port and --rtspport could fix the issue for all types of cameras and connections. So it could be issued like:

unifi-cam-proxy --host IP -i 34.24.24.1 --port 8081 --mac '08:a1:89:92:74:c9' --cert client.pem --token 238482h34jj2 hikvision -u admin -p Som3PasS --rtspport 10554

acseven commented 2 years ago

+1 I'm also requiring this feature to get remote Hikvision cameras working...

keshavdv commented 2 years ago

I'd recommend using the RTSP camera implementation rather than the Hikvision specific one because there are a few other elements that require direct HTTP API access will not work correctly (e.g. snapshot fetching). That should let you get around any weird network topology requirements at least for the time being.

edavrio commented 2 years ago

Actually we did everything. It even supports Record on Motion and other things. We did a fork of the current repo and we will release it soon.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

GhostlyCrowd commented 2 years ago

@edavrio so this has been marked as stale, in the interest of open source are you going to be submitting a pull request with your improvements?