koush / scrypted

Scrypted is a high performance video integration and automation platform
https://scrypted.app
Other
4.17k stars 248 forks source link

RTSP camera doesnt authenticate #1014

Closed prbreezy closed 1 year ago

prbreezy commented 1 year ago

Hi

Scrypted is unable to authenticate with RTSP procotocol to My VIGI C540, below the trace

[Rebroadcast Plugin]: Stream 1 prebuffer session started [Rebroadcast Plugin]: Stream 1 prebuffer session starting stream url rtsp://192.168.50.222:554/stream1 [Rebroadcast Plugin]: rtsp outgoing message [Rebroadcast Plugin]: OPTIONS rtsp://192.168.50.222:554/stream1 RTSP/1.0 [Rebroadcast Plugin]: CSeq: 0 [Rebroadcast Plugin]: User-Agent: Scrypted [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp incoming message [Rebroadcast Plugin]: RTSP/1.0 200 OK [Rebroadcast Plugin]: CSeq: 0 [Rebroadcast Plugin]: Date: Sat, Aug 12 2023 01:09:31 GMT [Rebroadcast Plugin]: Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp outgoing message [Rebroadcast Plugin]: DESCRIBE rtsp://192.168.50.222:554/stream1 RTSP/1.0 [Rebroadcast Plugin]: Accept: application/sdp [Rebroadcast Plugin]: CSeq: 1 [Rebroadcast Plugin]: User-Agent: Scrypted [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp incoming message [Rebroadcast Plugin]: RTSP/1.0 401 Unauthorized [Rebroadcast Plugin]: CSeq: 1 [Rebroadcast Plugin]: Date: Sat, Aug 12 2023 01:09:31 GMT [Rebroadcast Plugin]: WWW-Authenticate: Basic realm="TP-LINK IP-Camera" [Rebroadcast Plugin]: WWW-Authenticate: Digest realm="TP-LINK IP-Camera", nonce="09afbf21fc8c9fe524cdff98a6d09299" [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp outgoing message [Rebroadcast Plugin]: DESCRIBE rtsp://192.168.50.222:554/stream1 RTSP/1.0 [Rebroadcast Plugin]: Accept: application/sdp [Rebroadcast Plugin]: CSeq: 2 [Rebroadcast Plugin]: User-Agent: Scrypted [Rebroadcast Plugin]: Authorization: Basic YWRtaW46ejZZUnRVWUNtQjR4QTk= [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp incoming message [Rebroadcast Plugin]: RTSP/1.0 401 Unauthorized [Rebroadcast Plugin]: CSeq: 2 [Rebroadcast Plugin]: Date: Sat, Aug 12 2023 01:09:32 GMT [Rebroadcast Plugin]: WWW-Authenticate: Basic realm="TP-LINK IP-Camera" [Rebroadcast Plugin]: WWW-Authenticate: Digest realm="TP-LINK IP-Camera", nonce="af809ea1347305198c551630e487b995" [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp outgoing message [Rebroadcast Plugin]: TEARDOWN rtsp://192.168.50.222:554/stream1 RTSP/1.0 [Rebroadcast Plugin]: CSeq: 3 [Rebroadcast Plugin]: User-Agent: Scrypted [Rebroadcast Plugin]: Authorization: Basic YWRtaW46ejZZUnRVWUNtQjR4QTk= [Rebroadcast Plugin]: [Rebroadcast Plugin]: Stream 1 prebuffer session ended with error Error: auth failed [Rebroadcast Plugin]: at t.RtspClient.request (/@scrypted/prebuffer-mixin/main.nodejs.js:1:91326) [Rebroadcast Plugin]: at process.processTicksAndRejections (node:internal/process/task_queues:95:5) [Rebroadcast Plugin]: at async t.startRtspSession (/@scrypted/prebuffer-mixin/main.nodejs.js:1:143016) [Rebroadcast Plugin]: at async U.startPrebufferSession (/@scrypted/prebuffer-mixin/main.nodejs.js:1:116729) [Rebroadcast Plugin]: C540 - 2 restarting prebuffer session in 5 seconds [Rebroadcast Plugin]: rebroadcast error Error: rtsp socket closed [Rebroadcast Plugin]: at Socket.<anonymous> (/@scrypted/prebuffer-mixin/main.nodejs.js:1:142830) [Rebroadcast Plugin]: at Socket.emit (node:events:513:28) [Rebroadcast Plugin]: at Socket.emit (node:domain:489:12) [Rebroadcast Plugin]: at TCP.<anonymous> (node:net:322:12)

Thanks!

wcgoh commented 1 year ago

I am also facing the same issue to authenticate TP-Link Vigi C330i using the ONVIF Plug-in. The error message looks the same as yours. Using Synology surveillance there was not issue adding the camera using ONVIF plugin. Attached is the error message. There is the same "RTSP/1.0 401 Unauthorized" error

[Rebroadcast Plugin]: mainStream prebuffer session started [Rebroadcast Plugin]: mainStream prebuffer session starting stream url rtsp://10.0.0.44:554/stream1 [Rebroadcast Plugin]: rtsp outgoing message [Rebroadcast Plugin]: OPTIONS rtsp://10.0.0.44:554/stream1 RTSP/1.0 [Rebroadcast Plugin]: CSeq: 0 [Rebroadcast Plugin]: User-Agent: Scrypted [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp incoming message [Rebroadcast Plugin]: RTSP/1.0 200 OK [Rebroadcast Plugin]: CSeq: 0 [Rebroadcast Plugin]: Date: Sat, Aug 12 2023 14:29:34 GMT [Rebroadcast Plugin]: Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp outgoing message [Rebroadcast Plugin]: DESCRIBE rtsp://10.0.0.44:554/stream1 RTSP/1.0 [Rebroadcast Plugin]: Accept: application/sdp [Rebroadcast Plugin]: CSeq: 1 [Rebroadcast Plugin]: User-Agent: Scrypted [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp incoming message [Rebroadcast Plugin]: RTSP/1.0 401 Unauthorized [Rebroadcast Plugin]: CSeq: 1 [Rebroadcast Plugin]: Date: Sat, Aug 12 2023 14:29:34 GMT [Rebroadcast Plugin]: WWW-Authenticate: Basic realm="TP-LINK IP-Camera" [Rebroadcast Plugin]: WWW-Authenticate: Digest realm="TP-LINK IP-Camera", nonce="69b4f82edd73ed63e542d1c0db9bfaa5" [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp outgoing message [Rebroadcast Plugin]: DESCRIBE rtsp://10.0.0.44:554/stream1 RTSP/1.0 [Rebroadcast Plugin]: Accept: application/sdp [Rebroadcast Plugin]: CSeq: 2 [Rebroadcast Plugin]: User-Agent: Scrypted [Rebroadcast Plugin]: Authorization: Basic YWRtaW46SHVmaDAzMjglMjN2aWc= [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp incoming message [Rebroadcast Plugin]: RTSP/1.0 401 Unauthorized [Rebroadcast Plugin]: CSeq: 2 [Rebroadcast Plugin]: Date: Sat, Aug 12 2023 14:29:34 GMT [Rebroadcast Plugin]: WWW-Authenticate: Basic realm="TP-LINK IP-Camera" [Rebroadcast Plugin]: WWW-Authenticate: Digest realm="TP-LINK IP-Camera", nonce="ac1f4d87a955b660f2580a423659e318" [Rebroadcast Plugin]: [Rebroadcast Plugin]: rtsp outgoing message [Rebroadcast Plugin]: TEARDOWN rtsp://10.0.0.44:554/stream1 RTSP/1.0 [Rebroadcast Plugin]: CSeq: 3 [Rebroadcast Plugin]: User-Agent: Scrypted [Rebroadcast Plugin]: Authorization: Basic YWRtaW46SHVmaDAzMjglMjN2aWc= [Rebroadcast Plugin]: [Rebroadcast Plugin]: mainStream prebuffer session ended with error Error: auth failed [Rebroadcast Plugin]: at t.RtspClient.request (/@scrypted/prebuffer-mixin/main.nodejs.js:1:91326) [Rebroadcast Plugin]: at process.processTicksAndRejections (node:internal/process/task_queues:95:5) [Rebroadcast Plugin]: at async t.startRtspSession (/@scrypted/prebuffer-mixin/main.nodejs.js:1:143016) [Rebroadcast Plugin]: at async U.startPrebufferSession (/@scrypted/prebuffer-mixin/main.nodejs.js:1:116729) [Rebroadcast Plugin]: VIGI C330I restarting prebuffer session in 5 seconds [Rebroadcast Plugin]: rebroadcast error Error: rtsp socket closed [Rebroadcast Plugin]: at Socket.<anonymous> (/@scrypted/prebuffer-mixin/main.nodejs.js:1:142830) [Rebroadcast Plugin]: at Socket.emit (node:events:514:28) [Rebroadcast Plugin]: at Socket.emit (node:domain:489:12) [Rebroadcast Plugin]: at TCP.<anonymous> (node:net:323:12)

prbreezy commented 1 year ago

@wcgoh maybe it's a problem with the VIGI?

For some reason when I setup the VIGI the first time I could not add it to Surveillance station, then I'd to reset my VIGI cam (by pressure the reset hidden button) to be able to add it to SS.

So I'm wondering if this is not a limitation with VIGI cams?

If you delete your VIGI cam from the VIGI app and try to add it again will it work? (for me no) I need to reset first like I said..

Maybe it's unrelated but you're now the 2nd personne with this error and you're also using a VIGI cam.

wcgoh commented 1 year ago

@wcgoh maybe it's a problem with the VIGI?

For some reason when I setup the VIGI the first time I could not add it to Surveillance station, then I'd to reset my VIGI cam (by pressure the reset hidden button) to be able to add it to SS.

So I'm wondering if this is not a limitation with VIGI cams?

If you delete your VIGI cam from the VIGI app and try to add it again will it work? (for me no) I need to reset first like I said..

Maybe it's unrelated but you're now the 2nd personne with this error and you're also using a VIGI cam.

I can add back the camera after reseting, just not able to get the ONVIF or the RSTP plugin to work with it.

prbreezy commented 1 year ago

@wcgoh maybe it's a problem with the VIGI? For some reason when I setup the VIGI the first time I could not add it to Surveillance station, then I'd to reset my VIGI cam (by pressure the reset hidden button) to be able to add it to SS. So I'm wondering if this is not a limitation with VIGI cams? If you delete your VIGI cam from the VIGI app and try to add it again will it work? (for me no) I need to reset first like I said.. Maybe it's unrelated but you're now the 2nd personne with this error and you're also using a VIGI cam.

I can add back the camera after reseting, just not able to get the ONVIF or the RSTP plugin to work with it.

Without resetting you're not able to add it ? I will try to reset it tomorrow and to add it immediately after.

Or we're just facing a bug with VIGI camera because TAPO C200 works fine.

koush commented 1 year ago

Enable Digest authentication, disable basic uathenciation. please refer to the docs.scrypted.app for camera setup.

wcgoh commented 1 year ago

Enable Digest authentication, disable basic uathenciation. please refer to the docs.scrypted.app for camera setup.

Was not able to find Digest authentication for Vigi (Using Vigi security Manager). However was able to resolve ONVIF issue by following method

  1. Open Vigi security manager (windows)
  2. Select the camera
  3. Go to System Settings/Reset -> Reset to Factory Default
  4. Setup the camera, this time the password i use doesn't have special character (just alphanumeric)
  5. Add the camera in Scrypted/ONVIF

This was how i resolve the issue, not sure if during the setup there was an issue, or the special character i used for the password. But now there is a new problem, the snapshot doesn't work. Here is the error message

Snapshot Plugin]: Snapshot failed Error: ffmpeg input to image conversion failed with exit code: 1, /usr/bin/ffmpeg -hide_banner -y -f image2pipe -i pipe:4 -filter_complex scale=-2:'min(720,ih)' -frames:v 1 -f image2 pipe:3 [Snapshot Plugin]: at /src/ffmpeg-image-filter.ts:178:23 [Snapshot Plugin]: at processTicksAndRejections (node:internal/process/task_queues:95:5) [Snapshot Plugin]: creating error image with background Snapshot Failed true [Snapshot Plugin]: Snapshot failed Error: ffmpeg input to image conversion failed with exit code: 1, /usr/bin/ffmpeg -hide_banner -y -f image2pipe -i pipe:4 -filter_complex scale=-2:'min(720,ih)' -frames:v 1 -f image2 pipe:3 [Snapshot Plugin]: at /src/ffmpeg-image-filter.ts:178:23 [Snapshot Plugin]: at processTicksAndRejections (node:internal/process/task_queues:95:5) [Snapshot Plugin]: creating error image with background Snapshot Failed true

prbreezy commented 1 year ago

Enable Digest authentication, disable basic uathenciation. please refer to the docs.scrypted.app for camera setup.

Was not able to find Digest authentication for Vigi (Using Vigi security Manager).

However was able to resolve ONVIF issue by following method

  1. Open Vigi security manager (windows)

  2. Select the camera

  3. Go to System Settings/Reset -> Reset to Factory Default

  4. Setup the camera, this time the password i use doesn't have special character (just alphanumeric)

  5. Add the camera in Scrypted/ONVIF

This was how i resolve the issue, not sure if during the setup there was an issue, or the special character i used for the password.

But now there is a new problem, the snapshot doesn't work. Here is the error message

`Snapshot Plugin]: Snapshot failed Error: ffmpeg input to image conversion failed with exit code: 1, /usr/bin/ffmpeg -hide_banner -y -f image2pipe -i pipe:4 -filter_complex scale=-2:'min(720,ih)' -frames:v 1 -f image2 pipe:3

[Snapshot Plugin]: at /src/ffmpeg-image-filter.ts:178:23

[Snapshot Plugin]: at processTicksAndRejections (node:internal/process/task_queues:95:5)

[Snapshot Plugin]: creating error image with background Snapshot Failed true

[Snapshot Plugin]: Snapshot failed Error: ffmpeg input to image conversion failed with exit code: 1, /usr/bin/ffmpeg -hide_banner -y -f image2pipe -i pipe:4 -filter_complex scale=-2:'min(720,ih)' -frames:v 1 -f image2 pipe:3

[Snapshot Plugin]: at /src/ffmpeg-image-filter.ts:178:23

[Snapshot Plugin]: at processTicksAndRejections (node:internal/process/task_queues:95:5)

[Snapshot Plugin]: creating error image with background Snapshot Failed true`

For me onvif works fine. If you have an issue with snapshots I would suggest to create a new issue to avoid mixing the topics.