potmat / homebridge-google-nest-sdm

A Homebridge plugin for Google Nest devices that uses the Google Smart Device Management API. Supports Cameras, Doorbells, Displays, and Thermostats. Includes support for HomeKit Secure Video.
ISC License
140 stars 17 forks source link

Cameras Fail on Synology NAS #71

Closed futandrew closed 1 year ago

futandrew commented 1 year ago

I saw this documentation from HomeAssistant https://www.home-assistant.io/integrations/nest#camera which supports some cameras stream using WebRTC protocol. I'm wondering if this plugin can support this. Because this plugin has the ability to use HKSV, and believe this will be better if streaming is possible. Thanks/

potmat commented 1 year ago

I'm not sure what you mean. This plugin supports the latest generation of Google Nest cameras, which use WebRTC.

futandrew commented 1 year ago

Currently, the camera does not live stream videos, instead only nest home blue logo is shown. According to your readme, this is just a placeholder. However, using the homeassistant plugin which I shared above, it can stream/live stream the camera feed real time.

potmat commented 1 year ago
  1. If you see the Nest blue logo that's a generation one camera which uses RTSP not WebRTC
  2. What happens when you click/press on the camera to view the stream?
futandrew commented 1 year ago
  1. It should be able to use the WebRTC protocol since I can use it successfully with the mentioned addon.
  2. If I try to view the stream, it will fail and the log will display [homebridge-google-nest-sdm] FFmpeg exited with code: 1 and signal: null (Error) My Camera
potmat commented 1 year ago

If you have a generation one camera it does not use the WebRTC protocol, ever. Nor is there any way to force it. Generation two cameras use WebRTC. This plugin supports both.

If you enable debug mode we should be able to see more info about why the stream is failing.

futandrew commented 1 year ago

haha sure if you insist i am making things up. I surely happy to debug it later and share more information.

potmat commented 1 year ago

"haha sure if you insist i am making things up"

Please refrain from such language in the future.

Yes Home Assistant can use WebRTC, so can this plugin. Which streaming method a Nest Camera uses depends on which type of Nest Camera it is. You can see from the documentation here https://developers.google.com/nest/device-access/traits/device/camera-live-stream that the older cameras use RTSP streams and the newer cameras use WebRTC streams, and that they are not interchangable.

futandrew commented 1 year ago

I'm sorry if you are sensing anything that was not intended. All I want to do is to emphasize the fact I encountered.

As follows, please see the debug log. I masked out some token information with ***, I hope that won't affect the troubleshooting.

I crosschecked with HomeAssistant again today, and it is still working fine with live streaming. I want to stick with this home bridge plugin is because this is the only addon I can find which supports HKSV.

[2/27/2023, 8:00:29 PM] [homebridge-google-nest-sdm] Restoring existing accessory from cache: My Camera [2/27/2023, 8:00:43 PM] [homebridge-google-nest-sdm] Video stream requested: 1280 x 720, 30 fps, 299 kbps My Camera [2/27/2023, 8:00:43 PM] [homebridge-google-nest-sdm] Executing command sdm.devices.commands.CameraLiveStream.GenerateRtspStream with parameters undefined My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] Execution of command sdm.devices.commands.CameraLiveStream.GenerateRtspStream returned {"streamUrls":{"rtspUrl":"rtsps://stream-us1-foxtrot.dropcam.com:443/sdm_live_stream/","streamToken":"g.0.","expiresAt":"2023-02-28T04:05:44.190Z"} My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] Stream command: ffmpeg -analyzeduration 15000000 -probesize 100000000 -i rtsps://stream-us1-foxtrot.dropcam.com:443/sdm_live_stream -an -sn -dn -codec:v libx264 -preset ultrafast -tune zerolatency -pix_fmt yuv420p -color_range mpeg -bf 0 -r 30 -b:v 1196k -bufsize 1196k -maxrate 2392k -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale=trunc(iw/2)2:trunc(ih/2)2 -payload_type 99 -ssrc 13833050 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params F9iD1bM1s/UITNAMAwXjr0uKvFW+HF/+dTgzXcQ7 srtp://192.168.1.253:58630?rtcpport=58630&pkt_size=1378 -vn -sn -dn -codec:a libfdk_aac -profile:a aac_eld -flags +global_header -ar 16k -b:a 24k -ac 1 -payload_type 110 -ssrc 10163684 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params REJi86QJ0mPqWksiupaPCiK+JTQHoxJ5S3y1rY+E srtp://192.168.1.253:49542?rtcpport=49542&pkt_size=188 -loglevel level+verbose undefined My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] ffmpeg version 4.1.8 Copyright (c) 2000-2021 the FFmpeg developers My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] built with gcc 8.5.0 (GCC) My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] configuration: --prefix=/usr --incdir='${prefix}/include/ffmpeg' --arch=i686 --target-os=linux --cross-prefix=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-shared --disable-static --disable-stripping --enable-version3 --enable-encoders --enable-pthreads --disable-protocols --disable-protocol=rtp --enable-protocol=file --enable-protocol=pipe --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffplay --disable-ffprobe --disable-doc --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-vaapi --disable-cuvid --disable-nvenc --disable-decoder=aac --disable-decoder=aac_fixed --disable-encoder=aac --disable-decoder=amrnb --disable-decoder=ac3 --disable-decoder=ac3_fixed --disable-encoder=zmbv --disable-encoder=dca --disable-decoder=dca --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-decoder=eac3 --disable-encoder=truehd --disable-decoder=truehd --disable-encoder=hevc_vaapi --disable-decoder=hevc --disable-muxer=hevc --disable-demuxer=hevc --disable-parser=hevc --disable-bsf=hevc_mp4toannexb --x86asmexe=yasm --cc=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-wrap-gcc --enable-yasm --enable-libx264 --enable-encoder=libx264 My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] libavutil 56. 22.100 / 56. 22.100 My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] libavcodec 58. 35.100 / 58. 35.100 My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] libavformat 58. 20.100 / 58. 20.100 My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] libavdevice 58. 5.100 / 58. 5.100 My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] libavfilter 7. 40.101 / 7. 40.101 My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] libswscale 5. 3.100 / 5. 3.100 My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] libswresample 3. 3.100 / 3. 3.100 My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [info] libpostproc 55. 3.100 / 55. 3.100 My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [error] Unrecognized option 'srtp_out_suite'. My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [fatal] Error splitting the argument list: Option not found My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] FFmpeg exited with code: 1 and signal: null (Error) My Camera [2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] Executing command sdm.devices.commands.CameraLiveStream.StopRtspStream with parameters {"streamExtensionToken":""} My Camera [2/27/2023, 8:00:45 PM] [homebridge-google-nest-sdm] Execution of command sdm.devices.commands.CameraLiveStream.StopRtspStream returned undefined My Camera [2/27/2023, 8:00:45 PM] [homebridge-google-nest-sdm] Stopped video stream. My Camera

Thanks for your help! And again, my apologies for any misunderstanding in my tone.

potmat commented 1 year ago

The problem is here

[2/27/2023, 8:00:44 PM] [homebridge-google-nest-sdm] [error] Unrecognized option 'srtp_out_suite'.

Looks like the problem is whatever device you're using has ffmpeg 4.1, which is very out of date. Here is a thread about using a Synology NAS with exactly the same problem, possibly you're using the same setup?

futandrew commented 1 year ago

Thanks for the quick response. I followed that article and updated ffmpeg in Synology. Also, I noticed you posted an update with ffmpeg. So I reinstalled this plugin again. Now it is showing a more weird error with "Server returned 404 Not Found My Camera" now...

I tried to delete all projects on the Google API and Device Access Console and followed the step by step setup again, but it is not helping :(

potmat commented 1 year ago

Maybe https://github.com/potmat/homebridge-google-nest-sdm/issues/4

Provide some logs from around when the issue happens.

potmat commented 1 year ago

Closing due to lack of activity.