keshavdv / unifi-cam-proxy

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

Amcrest RTSP possible? #98

Closed ziptbm closed 2 years ago

ziptbm commented 2 years ago

Is it possible to use this with Amcrest cameras rtsp?

Still working through the config to see if one of the options will work, but asking in case anyone has found a method that works or knows why it won’t.

Ranger2959 commented 2 years ago

I got it working with my Amcrest IP5M-B1186EB using the RSTP and Frigate options. I haven't gotten the live view to work on my browser yet but it does work in the mobile app. I opened #97 to see why it doesn't work in my browser but works in mobile. That seems like a problem with any stream I use, not just Amcrest so its something non specific to cameras.

ziptbm commented 2 years ago

Thanks! So far I've been able to get it to show a static image in both the browser and iOS app, but I can't get it to stream a Live View.

This camera is an Amcrest IP8M-T2669EW-AI, so the primary stream is 4k so I found that making it think it's a G4 Pro at least brings in the 4k option in the UI.

Here's the command I'm using to get this far, but still haven't successfully enabled Live View. Wonder if this is related to live view issues you're seeing...suggestions/ideas are appreciated.

unifi-cam-proxy -H <host IP> --mac <camera mac> -i <camera IP> -c client.pem -t <token> --model 'UVC G4 Pro' rtsp -s 'rtsp://<username:password@camera IP>:554/cam/realmonitor?channel=1&subtype=0'

UPDATE - I just tried this with an older Amcrest IP3M-HX2 and it appears to work with the stream without issue. This is a only a 3MP camera and H264, so I'm wondering if it's just not liking the 8MP with H265 from the other one.

Ranger2959 commented 2 years ago

What version of protect are you running?

My guess based on reading through some of the issues in this repo is you will have to play around with --ffmpeg-args until you get it to work. Posting any logs from this package and logs from the network console would probably be helpful too.

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.

ziptbm commented 2 years ago

If anyone in the future is looking for how to make this work with an Amcrest IP camera, I was successful in using this command syntax.

unifi-cam-proxy --verbose --ip "<ip>" --mac <mac> --host <host ip> --cert <directory>/client.pem --token <token> rtsp -s 'rtsp://<username>:<password>@<ip>:554/cam/realmonitor?channel=1&subtype=0'

ascott18 commented 2 years ago

This proxy outputs an FLV stream from ffmpeg. FLV can't handle HEVC (H265) - the proxy will fail without any feedback, but if you take the ffmpeg command from the program output and run it on its own, you'll see an error from ffmpeg. So, you need to set your camera to H264.

That said, I still haven't managed to get this working. Snapshots work, but live video and recording don't. The ffmpeg command is working and outputting data. Amcrest IP8M-T2599EW

Edit: My issue with recording was that I was running this on Windows, and since the ffmpeg process is spawned with the system shell (cmd.exe) which has really bad pipe performance, ffmpeg is only able to keep up at about 10% of the rate of the video. You can see this if you remove stderr=subprocess.DEVNULL, from base.py.

Update: This comment was the secret sauce to get the live feed working:.

rkbest13 commented 2 years ago

I have ubuntu server running with docker containers for the unifi protect NVR version 1.20.0. I am trying to get any camera to show up but not even the bigbuck bunny is shown. I don't have any unifi product so everything is virtual. unifi protect on docker and unifi-proxy-cams on docker as well. do I need anything else to make this work?

I have few questions for cameras:

  1. are the cameras auto detected if the proxy cam are set correctly?
  2. how do i make sure amcrest is set up as proxy cam gets added (forced or manually).
    1. my virtual NVR runs in docker at IP:7080, do i need to include port in the proxy-cam setup to make it direct the stream correctly? Any help is appreciated. @ascott18 @ziptbm @Chrisgozd Thanks