keshavdv / unifi-cam-proxy

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

No Video in Unifi Protect #74

Closed xSPARExSTEWx closed 2 years ago

xSPARExSTEWx commented 3 years ago

After trying many different things I finally got the device in Unifi Protect to change from Unknown Device to G3 Micro, but I do not get any camera feed at all, it just has the loading wheel in Protect. Not really sure where to go from here. My camera is a Lortex LNB8921B with the video settings to match the specs of the G3 Micro as much as possible.

Command I use: unifi-cam-proxy -H 192.168.1.1 -i 192.168.1.125 -c client.pem -t 9Uzb9KICUqL3YSRv3IISssgfDfwD1yW5 rtsp -s rtsp://admin:benmatt11@192.168.1.125:554/cam/realmonitor?channel=1&subtype=0

Output that cycles: 2021-08-27 23:59:00 test RTSPCam[4717] INFO Spawning stream for snapshots: ffmpeg -nostdin -y -re -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125:554/cam/realmonitor?channel=1" -vf fps=1 -update 1 /tmp/tmprv732q6g/screen.jpg 2021-08-27 23:59:00 test Core[4717] INFO Creating ws connection to wss://192.168.1.1:7442/camera/1.0/ws?token=9Uzb9KICUqL3YSRv3IISssgfDfwD1yW5 2021-08-27 23:59:00 test RTSPCam[4717] INFO Adopting with token [9Uzb9KICUqL3YSRv3IISssgfDfwD1yW5] and mac [AABBCCDDEEFF] 2021-08-27 23:59:00 test RTSPCam[4717] INFO Processing [ubnt_avclient_hello] message 2021-08-27 23:59:00 test RTSPCam[4717] INFO Processing [ubnt_avclient_hello] message 2021-08-27 23:59:01 test RTSPCam[4717] INFO Processing [ubnt_avclient_paramAgreement] message 2021-08-27 23:59:01 test RTSPCam[4717] INFO Processing [ubnt_avclient_paramAgreement] message 2021-08-27 23:59:01 test RTSPCam[4717] INFO Processing [StopService] message 2021-08-27 23:59:01 test RTSPCam[4717] INFO Processing [ChangeVideoSettings] message 2021-08-27 23:59:01 test RTSPCam[4717] INFO Spawning ffmpeg for video2 (aNBEAMCLhlMP0agS): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125:554/cam/realmonitor?channel=1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=aNBEAMCLhlMP0agS -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-08-27 23:59:01 test RTSPCam[4717] INFO Processing [UpdateFirmwareRequest] message 2021-08-27 23:59:01 test RTSPCam[4717] INFO Reconnecting... 2021-08-27 23:59:01 test RTSPCam[4717] INFO Cleaning up instance 2021-08-27 23:59:01 test RTSPCam[4717] INFO Stopping stream video2 2021-08-27 23:59:01 test Core[4717] INFO Backing off connect(...) for 2.0s (True) test@test:~$ 2021-08-27 23:59:03 test Core[4717] INFO Creating ws connection to wss://192.168.1.1:7442/camera/1.0/ws?token=9Uzb9KICUqL3YSRv3IISssgfDfwD1yW5 2021-08-27 23:59:03 test RTSPCam[4717] INFO Adopting with token [9Uzb9KICUqL3YSRv3IISssgfDfwD1yW5] and mac [AABBCCDDEEFF] 2021-08-27 23:59:03 test RTSPCam[4717] INFO Processing [ubnt_avclient_hello] message 2021-08-27 23:59:03 test RTSPCam[4717] INFO Processing [ubnt_avclient_hello] message 2021-08-27 23:59:04 test RTSPCam[4717] INFO Processing [ubnt_avclient_paramAgreement] message 2021-08-27 23:59:04 test RTSPCam[4717] INFO Processing [ubnt_avclient_paramAgreement] message 2021-08-27 23:59:04 test RTSPCam[4717] INFO Processing [StopService] message 2021-08-27 23:59:04 test RTSPCam[4717] INFO Processing [ChangeVideoSettings] message 2021-08-27 23:59:04 test RTSPCam[4717] INFO Spawning ffmpeg for video1 (FZssyfChjHS5FOlT): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125:554/cam/realmonitor?channel=1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=FZssyfChjHS5FOlT -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-08-27 23:59:04 test RTSPCam[4717] INFO Processing [ChangeVideoSettings] message 2021-08-27 23:59:04 test RTSPCam[4717] INFO Spawning ffmpeg for video3 (7OGsmscygghKBdME): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125:554/cam/realmonitor?channel=1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=7OGsmscygghKBdME -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-08-27 23:59:04 test RTSPCam[4717] INFO Processing [ChangeDeviceSettings] message 2021-08-27 23:59:04 test RTSPCam[4717] INFO Processing [NetworkStatus] message 2021-08-27 23:59:04 test RTSPCam[4717] INFO Processing [GetSystemStats] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [ChangeIspSettings] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [ChangeOsdSettings] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [ChangeSoundLedSettings] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [ChangeVideoSettings] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [ChangeSmartMotionSettings] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [EnableLogging] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [ChangeDeviceSettings] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [ChangeDeviceSettings] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [SmartMotionTest] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [ChangeVideoSettings] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [UpdateUsernamePassword] message 2021-08-27 23:59:09 test RTSPCam[4717] INFO Processing [ChangeVideoSettings] message 2021-08-27 23:59:12 test RTSPCam[4717] INFO Processing [NetworkStatus] message 2021-08-27 23:59:12 test RTSPCam[4717] INFO Processing [GetSystemStats] message

keshavdv commented 3 years ago

You need to quote the RTSP string when you run it because it contains an ampersand. If you look closely in the logs, you'll see the string getting passed to ffmpeg isn't the same as the one you passed in. Try:

unifi-cam-proxy -H 192.168.1.1 -i 192.168.1.125 -c client.pem -t 9Uzb9KICUqL3YSRv3IISssgfDfwD1yW5 rtsp -s 'rtsp://admin:benmatt11@192.168.1.125:554/cam/realmonitor?channel=1&subtype=0'

xSPARExSTEWx commented 3 years ago

Well, I feel stupid for not seeing that. I get my feed now and switching the model to the G4 Pro I can get 4k 15fps playback! My CPU usage is like 35% on an i3-4030U from this script alone, is that normal?

Probably another question that I am overlooking too. Now I am trying to get motion detections working. I tried setting it up on Protect and is not working. Is the Camera supposed to detect motion or Unifi Protect?

keshavdv commented 3 years ago

The high cpu probably comes from the snapshot generation which by default does need to decode the stream. You can provide a --snapshot-url option to reduce the cost, but motion events will never work with the RTSP implementation. I'd give the Lorex implementation a shot since that should provide basic motion detection and also better handle snapshot creation:

unifi-cam-proxy -H -i -c client.pem -t lorex -u -p

xSPARExSTEWx commented 3 years ago

That is what I originally tried and I could not get a feed. This is what I get with lorex option. Looks to just get stuck trying to find the motion events from the camera. Every time I start the script it resets the offline timer in Protect, but stays offline and being an unknown device.

Command: unifi-cam-proxy -H 192.168.1.1 -i 192.168.1.125 -c client.pem -t F2vupubEQmh50rf3rGs3jeCwJMXQJ27A lorex -u admin -p benmatt11

Output: 2021-08-29 22:00:38 test Core[3614] INFO Creating ws connection to wss://192.168.1.1:7442/camera/1.0/ws?token=F2vupubEQmh50rf3rGs3jeCwJMXQJ27A 2021-08-29 22:00:38 test DahuaCam[3614] INFO Adopting with token [F2vupubEQmh50rf3rGs3jeCwJMXQJ27A] and mac [AABBCCDDEEFF] 2021-08-29 22:00:38 test DahuaCam[3614] INFO Connecting to motion events API: http://admin:benmatt11@192.168.1.125/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion] 2021-08-29 22:00:38 test DahuaCam[3614] INFO Processing [ubnt_avclient_hello] message 2021-08-29 22:00:38 test DahuaCam[3614] INFO Processing [ubnt_avclient_hello] message

keshavdv commented 3 years ago

Does the output hang there or are there more logs?

tsspmq commented 3 years ago

I have the same issue. Looking at the Dahua camera plugin for Home Assistant that another dev is doing, he had to work around an issue with digest auth in aiohttp. My cameras are older Lorex and only work with his, mine hang on your script at the same spot. I think thats the issue.

xSPARExSTEWx commented 3 years ago

Does the output hang there or are there more logs?

Just hangs. No CPU usage either.

tsspmq commented 3 years ago

I commented out the subscribe to motion events in the script and it works, so its in that area that is causing the hang.

xSPARExSTEWx commented 3 years ago

I commented out the subscribe to motion events in the script and it works, so its in that area that is causing the hang.

What did you comment out in the daua.py file so I can try also?

tsspmq commented 3 years ago
    async def run(self) -> None:
        if self.args.motion_index == -1:
            return
        url = (
            f"http://{self.args.username}:{self.args.password}@{self.args.ip}"
            "/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion]"
        )
        encoded_url = URL(url, encoded=True)

Sorry, I was wrong in what I did. I just tossed in --motion-index -1 on the command line. The second line checks for this and returns immediately without trying to sub.

keshavdv commented 3 years ago

@xSPARExSTEWx Can you share the output of running curl -v http://admin:benmatt11@192.168.1.125/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion] from the same machine running the proxy?

keshavdv commented 3 years ago

The proxy should no longer get stuck after 721c0663c94f0cd528d5d322022cd5336e5793d1, but I suspect that it's going to be tricky to support digest authentication with aiohttp. Can you share output running the latest code and confirm you see 401 auth failures?

xSPARExSTEWx commented 3 years ago

Sorry was out of town for a few days.

With the updated code for lorex cameras I am able to see the video in Protect but only when I set the camera to G4 Pro. I can only see video in the pop up player when I select 4k. Live view, 720p, and any preview screen does not work, just has the 3 loading dots.

Running the curl command I get:

Output when I run the lorex version of the command now (cycles the spawning video 2 and video 3 parts while it is running about every 10 seconds):

2021-09-09 01:02:46 test Core[4283] INFO Creating ws connection to wss://192.168.1.1:7442/camera/1.0/ws?token=mpRcXolhQNYEdgcYM9L5amhBmmMwcJ9E 2021-09-09 01:02:46 test DahuaCam[4283] INFO Adopting with token [mpRcXolhQNYEdgcYM9L5amhBmmMwcJ9E] and mac [AABBCCDDEEFF] 2021-09-09 01:02:46 test DahuaCam[4283] INFO Connecting to motion events API: http://admin:benmatt11@192.168.1.125/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion] 2021-09-09 01:02:46 test DahuaCam[4283] ERROR Motion API unsupported (status: 404) 2021-09-09 01:02:46 test DahuaCam[4283] INFO Processing [ubnt_avclient_hello] message 2021-09-09 01:02:46 test DahuaCam[4283] INFO Processing [ubnt_avclient_hello] message 2021-09-09 01:02:46 test DahuaCam[4283] INFO Processing [ubnt_avclient_paramAgreement] message 2021-09-09 01:02:46 test DahuaCam[4283] INFO Processing [ubnt_avclient_paramAgreement] message 2021-09-09 01:02:46 test DahuaCam[4283] INFO Processing [StopService] message 2021-09-09 01:02:47 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:02:47 test DahuaCam[4283] INFO Spawning ffmpeg for video1 (JHsNMDUAGbganjlE): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125/cam/realmonitor?channel=1&subtype=0" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=JHsNMDUAGbganjlE -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-09-09 01:02:47 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:02:47 test DahuaCam[4283] INFO Spawning ffmpeg for video2 (QOOEpQeqUEv46LJS): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125/cam/realmonitor?channel=1&subtype=1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=QOOEpQeqUEv46LJS -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-09-09 01:02:47 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:02:47 test DahuaCam[4283] INFO Spawning ffmpeg for video3 (n7I31usRSIoLS3Jv): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125/cam/realmonitor?channel=1&subtype=1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=n7I31usRSIoLS3Jv -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-09-09 01:02:47 test DahuaCam[4283] INFO Processing [UpdateFirmwareRequest] message 2021-09-09 01:02:47 test DahuaCam[4283] INFO Reconnecting... 2021-09-09 01:02:47 test DahuaCam[4283] INFO Cleaning up instance 2021-09-09 01:02:47 test DahuaCam[4283] INFO Stopping stream video1 2021-09-09 01:02:47 test DahuaCam[4283] INFO Stopping stream video2 2021-09-09 01:02:47 test DahuaCam[4283] INFO Stopping stream video3 2021-09-09 01:02:47 test Core[4283] INFO Backing off connect(...) for 2.0s (True) 2021-09-09 01:02:49 test Core[4283] INFO Creating ws connection to wss://192.168.1.1:7442/camera/1.0/ws?token=mpRcXolhQNYEdgcYM9L5amhBmmMwcJ9E 2021-09-09 01:02:49 test DahuaCam[4283] INFO Adopting with token [mpRcXolhQNYEdgcYM9L5amhBmmMwcJ9E] and mac [AABBCCDDEEFF] 2021-09-09 01:02:49 test DahuaCam[4283] INFO Connecting to motion events API: http://admin:benmatt11@192.168.1.125/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion] 2021-09-09 01:02:49 test DahuaCam[4283] ERROR Motion API unsupported (status: 404) 2021-09-09 01:02:49 test DahuaCam[4283] INFO Processing [ubnt_avclient_hello] message 2021-09-09 01:02:49 test DahuaCam[4283] INFO Processing [ubnt_avclient_hello] message 2021-09-09 01:02:49 test DahuaCam[4283] INFO Processing [ubnt_avclient_paramAgreement] message 2021-09-09 01:02:49 test DahuaCam[4283] INFO Processing [ubnt_avclient_paramAgreement] message 2021-09-09 01:02:49 test DahuaCam[4283] INFO Processing [StopService] message 2021-09-09 01:02:50 test DahuaCam[4283] INFO Processing [ChangeDeviceSettings] message 2021-09-09 01:02:50 test DahuaCam[4283] INFO Processing [NetworkStatus] message 2021-09-09 01:02:50 test DahuaCam[4283] INFO Processing [GetSystemStats] message 2021-09-09 01:02:50 test DahuaCam[4283] INFO Processing [GetRequest] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [ChangeIspSettings] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [ChangeOsdSettings] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [ChangeSoundLedSettings] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [ChangeSmartMotionSettings] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [EnableLogging] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [ChangeDeviceSettings] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [ChangeDeviceSettings] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [SmartMotionTest] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [UpdateUsernamePassword] message 2021-09-09 01:02:55 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:02:56 test DahuaCam[4283] INFO Processing [NetworkStatus] message 2021-09-09 01:02:56 test DahuaCam[4283] INFO Processing [GetSystemStats] message 2021-09-09 01:03:01 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:03:01 test DahuaCam[4283] INFO Spawning ffmpeg for video2 (QOOEpQeqUEv46LJS): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125/cam/realmonitor?channel=1&subtype=1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=QOOEpQeqUEv46LJS -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-09-09 01:03:01 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:03:01 test DahuaCam[4283] INFO Spawning ffmpeg for video3 (n7I31usRSIoLS3Jv): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125/cam/realmonitor?channel=1&subtype=1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=n7I31usRSIoLS3Jv -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-09-09 01:03:06 test DahuaCam[4283] INFO Processing [NetworkStatus] message 2021-09-09 01:03:06 test DahuaCam[4283] INFO Processing [GetSystemStats] message 2021-09-09 01:03:16 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:03:16 test DahuaCam[4283] INFO Spawning ffmpeg for video2 (QOOEpQeqUEv46LJS): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125/cam/realmonitor?channel=1&subtype=1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=QOOEpQeqUEv46LJS -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-09-09 01:03:16 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message 2021-09-09 01:03:16 test DahuaCam[4283] INFO Spawning ffmpeg for video3 (n7I31usRSIoLS3Jv): ffmpeg -nostdin -y -stimeout 15000000 -rtsp_transport tcp -i "rtsp://admin:benmatt11@192.168.1.125/cam/realmonitor?channel=1&subtype=1" -c:v copy -ar 32000 -ac 1 -codec:a aac -b:a 32k -metadata streamname=n7I31usRSIoLS3Jv -f flv - | /usr/bin/python3 -m unifi.clock_sync | nc 192.168.1.1 7550 2021-09-09 01:03:16 test DahuaCam[4283] INFO Processing [NetworkStatus] message 2021-09-09 01:03:16 test DahuaCam[4283] INFO Processing [GetSystemStats] message 2021-09-09 01:03:26 test DahuaCam[4283] INFO Processing [NetworkStatus] message 2021-09-09 01:03:26 test DahuaCam[4283] INFO Processing [GetSystemStats] message 2021-09-09 01:03:31 test DahuaCam[4283] INFO Processing [ChangeVideoSettings] message

keshavdv commented 3 years ago

Does your camera have a sub stream configured? It seems like the main stream is working correctly but the others aren't.

keshavdv commented 3 years ago

I think you can also add --sub-stream 0 to get around this and use the same stream for all three resolutions.

xSPARExSTEWx commented 3 years ago

Yeah the --sub-stream 0 fixed that issue and the spawning video 2 and 3 is not cycling anymore.

Still get the "ERROR Motion API unsupported (status: 404)" with motion events not working though. I am willing to help get motion events working if you want to try to support it.

m4tt075 commented 3 years ago

@xSPARExSTEWx I'm facing similar issues and have tried to create an adoption token for the G4 Pro instead of the G3 micro. You have apparently managed to do that. However, when I manually add the G4 Pro device in Protect on my UDMP, I don't get the option to proceed to the web and gerenate the token. It only works with the g3 micro, as outlined in @keshavdv's install instructions. How did you generate the G4 Pro adoption token, please?

samuelhautcoeur commented 3 years ago

@m4tt075 I don't think you can generate a token for anything but a G3 micro. Then, when launching unifi-cam-proxy, simply use the --model "UVC G4 Pro" parameter.

m4tt075 commented 3 years ago

Oh I see. Didn't see that. Thanks a lot. Will try it out tonight.

m4tt075 commented 3 years ago

OK, here my findings for an unbranded Dahua IPC. Whoever sold this did a great job. For the life of me I cannot figure out what model this is. It is a 4k model. Firmware is: V2.800.0000000.24.R, Build Date: 2020-10-14. Apparently this is the latest version, at least for the non-branded version of this cam. Doesn't matter. Should not make too much of a difference for the search strategy.

I've tested the rtsp, dahua and lorex approaches with the most recent ucp git version:

  1. IPC settings

    • I only changed the codec from H265 to H264 in the IPC video settings.
    • This was suggested in the Dahua wiki as it is a pre-requisite for streaming with VLC as well
    • Before testing ucp I ensured that streaming with VLC actually works, which it does.
  2. rtsp

    • Test-Command: unifi-cam-proxy --host --mac --cert client.pem --token --ip 192.168.1.201 --model 'UVC G4 Pro' rtsp -s 'rtsp://user:pwd@ip:554/cam/realmonitor?channel=1&subtype=0'
    • This is the only command that gets me through the authentication.
    • Adapting the model as indicated allowed me to see an up-to-date preview picture (snapshot) on the Unifi web interface.
    • The same picture appears when I activate the Live view, but then the picture is stuck in update mode (three circles) and does not update anymore, just like observed by the TO.
  3. dahua and lorex

    • Lorex workaround or not and no matter whether I adapt the model version, I cannot get beyond the hello messages.
    • The curl output seems to confirm the authentication issue you were suspecting:
      
      root@MyRS:/usr/src/ucp# curl -v http://user:pwd@192.168.1.201/cgi-bin/eventManager.cgi?action=attach&codes[VideoMotion]
      root@MyRS:/usr/src/ucp# * Expire in 0 ms for 6 (transfer 0x55b30e80cfb0)
    • Trying 192.168.1.201...
    • TCP_NODELAY set
    • Expire in 200 ms for 4 (transfer 0x55b30e80cfb0)
    • Connected to 192.168.1.201 (192.168.1.201) port 80 (#0)
    • Server auth using Basic with user 'user'

      GET /cgi-bin/eventManager.cgi?action=attach HTTP/1.1 Host: 192.168.1.201 Authorization: Basic YWRtaW46YWRtaW4xMjM= User-Agent: curl/7.64.0 Accept: /

      < HTTP/1.1 401 Unauthorized < WWW-Authenticate: Digest realm="Login to e31dd41486902f8f68bf4e95ff178b08", qop="auth", nonce="877356746", opaque="eb2c159c0cbd3d37bf788d269757651980659e95" < Connection: close < Set-Cookie:secure; HttpOnly < CONTENT-LENGTH: 0 <

    • Closing connection 0
      
      I don't think this really adds new insights. In any case, if you have any other suggestions what to test or you want me to test potential authentication fixes, please just let me know...
keshavdv commented 2 years ago

Can you share the ffprobe output for your cameras RTSP stream?

m4tt075 commented 2 years ago

Thanks for looking into this, @keshavdv!

Certainly. Here you go:

root@MyRS:/usr/src/ucp# ffprobe -i 'rtsp://usr:pwd@192.168.1.201:554/cam/realmonitor?channel=1&subtype=0'
ffprobe version 4.1.6-1~deb10u1 Copyright (c) 2007-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-
filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-
libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype 
--enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-
libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine
--enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-
libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-
libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-
libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100
libpostproc    55.  3.100 / 55.  3.100
Input #0, rtsp, from 'rtsp://usr:pwd@192.168.1.201:554/cam/realmonitor?channel=1&subtype=0':
Metadata:
title: Media Server
Duration: N/A, start: 0.200000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 100 tbr, 90k tbn, 180k tbc
root@MyRS:/usr/src/ucp#
m4tt075 commented 2 years ago

Confused! Ran ffprobe again and received different results. The IPC config is still the same!!!

I do get errors on the stream though. This is the output now:

[rtsp @ 0x56026a682100] max delay reached. need to consume packet
[rtsp @ 0x56026a682100] RTP: missed 90 packets
[h264 @ 0x56026a686100] left block unavailable for requested intra mode
[h264 @ 0x56026a686100] error while decoding MB 0 19, bytestream 96774
[h264 @ 0x56026a686100] concealing 5929 DC, 5929 AC, 5929 MV errors in I frame
Input #0, rtsp, from 'rtsp://usr:pwd@192.168.1.201:554/cam/realmonitor?channel=1&subtype=0':
Metadata:
title           : Media Server
Duration: N/A, start: 0.190000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 5 fps, 5 tbr, 90k tbn, 180k tbc
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.

ib54003 commented 2 years ago

Having the same issue no camera feed at all.

ffprobe -i 'rtsp://192.168.1.5'
ffprobe version 4.0.6 Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 7.5.0 (OpenWrt GCC 7.5.0 9882a54)
  configuration: --enable-cross-compile --cross-prefix=arm-openwrt-linux-muslgnueabi- --arch=arm --cpu=cortex-a9 --target-os=linux --prefix=/usr --pkg-config=pkg-config --enable-shared --enable-static --enable-pthreads --enable-zlib --disable-doc --disable-debug --enable-gpl --enable-version3 --disable-lzma --disable-vaapi --disable-vdpau --disable-outdevs --enable-avresample --disable-runtime-cpudetect --enable-lto --disable-vfp --disable-neon
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, rtsp, from 'rtsp://192.168.1.5':
  Metadata:
    title           : SDP data
  Duration: N/A, start: 14.820567, bitrate: N/A
    Stream #0:0: Video: h264 (Baseline), yuv420p(progressive), 640x480, 4 fps, 15 tbr, 90k tbn, 8 tbc