homebridge-eufy-security / plugin

Homebridge plugin to control certain Eufy Security devices
Apache License 2.0
157 stars 24 forks source link

[enhancement]: Ability to manually set RTSP transport type #181

Open apollo316 opened 1 year ago

apollo316 commented 1 year ago

Describe the solution you'd like

Can we get the option in advanced to set RTSP transport type to TCP or UDP?

github-actions[bot] commented 1 year ago

Did you check this Road Map pages ?

thieren commented 1 year ago

Hi @apollo316

this would be out of scope of this plugin.

You could try and ask this question at eufy-security-client since this library is used to get the data from the cameras.

However looking at that codebase I don't recall stumbling on a feature like that. Also I don't think that this is supported by eufy.

apollo316 commented 1 year ago

Well with homebridge-camera-ffmpeg v3.1.4 in Homebridge and the following config, my eufy camera's work just fine. But with the Eufy-security plugin I get no feed from the cameras. Homekit has the camera's and they just spin when trying to connect.

The debugging logs aren't terribly helpful, and I've done well over 30 Google searches for various "[error] method SETUP failed: 461 Unsupported transport." I couldn't get them working in streaming/internet mode either, though I prefer RTSP for local security. I've removed the cached device and from homebridge entirely, and from Homekit on my device. I can pull up the direct RTSP link in VLC, as well, without issue.

I've tried all the troubleshooting steps on the plugin page and the only thing I can figure is it needs the TCP connection type. I'm at a loss on this and had to disable the plugin for the time being but I was really excited to have actual Eufy functions within Homekit. Please let me know if you have any thoughts and thank you!

[image: image.png]

On Tue, Oct 11, 2022 at 1:06 AM thieren @.***> wrote:

Hi @apollo316 https://github.com/apollo316

this would be out of scope of this plugin.

You could try and ask this question at eufy-security-client https://github.com/bropat/eufy-security-client since this library is used to get the data from the cameras.

However looking at that codebase I don't recall stumbling on a feature like that. Also I don't think that this is supported by eufy.

— Reply to this email directly, view it on GitHub https://github.com/homebridge-eufy-security/plugin/issues/181#issuecomment-1274185374, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDWPA7VPWWF772WEMHIS4LWCUGY7ANCNFSM6AAAAAARBVIY7A . You are receiving this because you were mentioned.Message ID: @.***>

thieren commented 1 year ago

Maybe I don't really get what you're trying to do.

In principle the way that home bridge-camera-ffmpeg and this plugin utilise the stream are not that different. But I have to say that there were some changes made in the past.

With home bridge-camera-ffmpeg you'll have to manually set the rtsp stream url. What are you setting there? I'd assume it is the exact same url that is used by this plugin. Where does TCP come into play? Apart from TCP being the default protocol for rtsp streams. I didn't check which is used for Dufts RTSP, but I'd assume it's the default.

apollo316 commented 1 year ago

Thank you for the explanation! I'm just trying to use the Eufy-security plugin to view the RTSP streams from my Eufy camera's. Where would I "manually enter the RTSP stream URL" in the Eufy-security config? I have the full URL from the Eufy app but I don't see a place to manually enter it in the config, and when Homebridge launches it's automatically catching the RTSP URL's and username/pw from the Eufy account login: [image: image.png] What it grabbed is correct, but in Homekit I just get a spinning wheel when trying to launch the feed, the error in my last post, and then Connection Error in Homekit.

On Wed, Oct 12, 2022 at 10:55 PM thieren @.***> wrote:

Maybe I don't really get what you're trying to do.

In principle the way that home bridge-camera-ffmpeg and this plugin utilise the stream are not that different. But I have to say that there were some changes made in the past.

With home bridge-camera-ffmpeg you'll have to manually set the rtsp stream url. What are you setting there? I'd assume it is the exact same url that is used by this plugin. Where does TCP come into play? Apart from TCP being the default protocol for rtsp streams. I didn't check which is used for Dufts RTSP, but I'd assume it's the default.

— Reply to this email directly, view it on GitHub https://github.com/homebridge-eufy-security/plugin/issues/181#issuecomment-1277031001, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHDWPA2VWZNGUM64T3NTI2TWC6I25ANCNFSM6AAAAAARBVIY7A . You are receiving this because you were mentioned.Message ID: @.***>

thieren commented 1 year ago

Hi @apollo316

Sry for letting you wait so long. Did you figure it out in the meantime?

If not: you don't have to input the rtsp url anywhere as (like you have observed) the plugin gets it automatically. So the question is why the streaming fails. For that I'd need the log files for a streaming attempt. Can you provide these?

neuhausf commented 1 year ago

@thieren I get this problem too:

  1. RTSP Streaming enabled in your plugin
  2. Start streaming via Apple "Home"
  3. Log outputs something about "461 Unsupported transport"
  4. Stream starts anyway after a delay of about 2 seconds -> this could be an issue, that rtsp-transport must be specific: https://github.com/Sunoo/homebridge-camera-ffmpeg/discussions/1141 -> you could expose a config option for this. I was previously using camera-ui, which has such an option: https://github.com/seydx/homebridge-camera-ui/wiki/Cameras-Config

I support @apollo316 s request: Please allow adding the RTSP source. Use case: I use the rtsp-simple-server to proxy the eufy RTSP stream. This allows me to use the RTSP stream also in home-assistant, synology and co.

[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: Garage stream prepare request with session id 18f37863-98d4-4980-bc55-c9d9c2f461e8 was received.
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: Garage Received request to start stream with id 18f37863-98d4-4980-bc55-c9d9c2f461e8
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: Garage request data: {"sessionID":"18f37863-98d4-4980-bc55-c9d9c2f461e8","type":"start","video":{"codec":0,"profile":2,"level":2,"packetizationMode":0,"width":1280,"height":720,"fps":30,"pt":99,"ssrc":993109121,"max_bit_rate":299,"rtcp_interval":0.5,"mtu":1378},"audio":{"codec":"AAC-eld","channel":1,"bit_rate":0,"sample_rate":16,"packet_time":30,"pt":110,"ssrc":2555478536,"max_bit_rate":24,"rtcp_interval":5,"comfort_pt":13,"comfortNoiseEnabled":false}}
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: Garage VIDEOCONFIG: {"audio":true,"vcodec":"copy","useSeparateProcesses":true,"audioSampleRate":0}
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: Garage RTSP rtspStream:true
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: Garage RTSP cameraConfig: true
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: Garage RTSP true
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: Garage RTSP "rtsp://Ec1FPt9s0UIE:pw@192.168.1.246/live0"
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: Garage RTSP URL: rtsp://Ec1FPt9s0UIE:pw@192.168.1.246/live0
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: [Garage] [Video Process] Stream command: /homebridge/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -loglevel level+verbose -use_wallclock_as_timestamps 1 -i rtsp://Ec1FPt9s0UIE:pw@192.168.1.246/live0 -an -sn -dn -vcodec copy -payload_type 99 -ssrc 4809461 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params zMXyb78nMK0bRmBkE2AZnnDpyPRk6PGmXQerTFaB srtp://192.168.1.230:59708?rtcpport=59708&pkt_size=1128 -progress tcp://127.0.0.1:14252
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] INFO:  [Garage] [Video Process] Starting video stream: native
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] DEBUG: [Garage] [Audio Process] Stream command: /homebridge/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -loglevel level+verbose -i rtsp://Ec1FPt9s0UIE:pw@192.168.1.246/live0 -vn -sn -dn -acodec libfdk_aac -profile:a aac_eld -flags +global_header -b:a 24k -ar 16k -ac 1 -payload_type 110 -ssrc 7522870 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params MmtuJOVHiFWs5mvdmOhdsdirUTMmVj1QMdKjXPc2 srtp://192.168.1.230:50090?rtcpport=50090&pkt_size=188 -progress tcp://127.0.0.1:11793
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] INFO:  [Garage] [Audio Process] Starting audio stream: 16 kHz, 24 kbps, codec: libfdk_aac
[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] ERROR: [Garage] [Video Process] ffmpeg log message:
[tcp @ 0x556673c549c0] [verbose] Starting connection attempt to 127.0.0.1 port 14252
[tcp @ 0x556673c549c0] [verbose] Successfully connected to 127.0.0.1 port 14252
[tcp @ 0x556673c5fd40] [verbose] Starting connection attempt to 192.168.1.246 port 554
[tcp @ 0x556673c5fd40] [verbose] Successfully connected to 192.168.1.246 port 554
[rtsp @ 0x556673c5d100] [verbose] SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=H.264 Video,leco stream
c=IN IP4 0.0.0.0
t=0 0
a=tool:prv
a=control:*
m=video 0 RTP/AVP 96
b=AS:134
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=276400;sprop-parameter-sets=J2QAKq0AzoB4AiflmoCAgPgAAAMACAAAAwDxkAAFFcAAHoKL//gU,KO48sA==
a=control:trackID=0
m=audio 0 RTP/AVP 97
b=AS:131
a=rtpmap:97 MPEG4-GENERIC/16000/1
a=fmtp:97 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1408
a=control:trackID=1

[rtsp @ 0x556673c5d100] [error] method SETUP failed: 461 Unsupported transport
[rtsp @ 0x556673c5d100] [verbose] setting jitter buffer size to 0
[rtsp @ 0x556673c5d100] [verbose] setting jitter buffer size to 0

[12/16/2022, 9:06:18 AM] [EufySecurity-2.2.0-beta.14] ERROR: [Garage] [Audio Process] ffmpeg log message:
[rtsp @ 0x55b3d44ea200] [error] method SETUP failed: 461 Unsupported transport

[12/16/2022, 9:06:19 AM] [EufySecurity-2.2.0-beta.14] DEBUG: [Garage] [Video Process] process started. Getting the first response took 1.625 seconds.
[12/16/2022, 9:06:20 AM] [EufySecurity-2.2.0-beta.14] DEBUG: [Garage] [Audio Process] process started. Getting the first response took 1.999 seconds.
thieren commented 1 year ago

@neuhausf

Thx for your input and investigation in the matter.

Am I getting it right that you'd want two additional options:

  1. to set a ffmpeg parameter for rtsp_transport auto/tcp/udp
  2. to set a manual rtsp source so you could use a proxy rtsp stream from your cameras?

What exactly is the benefit of the second? Couldn't you just use the native rtsp stream from the cameras for all your smartphone software?

neuhausf commented 1 year ago

@thieren thx for the summary. My old cam (Tapo C210) had a hard limit of 1 or 2 parallel rtsp-streams. I think proxing the stream would offload the cam.

github-actions[bot] commented 10 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.