samemory / homebridge-eufy-security

Work in progress
Apache License 2.0
97 stars 14 forks source link

[Bug]: Cannot stream battery Doorbell (FFmpeg error 1 ) with version 1.0.6 #284

Closed DavTechFr closed 2 years ago

DavTechFr commented 2 years ago

What happened?

Hello,

I cannot stream the Doorbell due to FFmepg issue: ERROR: FFmpeg exited with code: 1 and signal: null (Error) Doorbell

I’ve tried to run this command: sudo npm i ffmpeg-for-homebridge -g

Same Issue

Device Type

Doorbell (Supported)

Plugin Version

v1.0.x (Supported)

HomeBridge Version

v1.3.x (Supported)

NodeJS Version

v14 (Supported)

Operating System

Raspbian

Relevant log output

[11/25/2021, 10:55:36 AM] [EufySecurity-1.0.6] DEBUG: Video stream requested: 1280 x 720, 30 fps, 299 kbps Doorbell false
[11/25/2021, 10:55:36 AM] [EufySecurity-1.0.6] INFO:  Starting video stream: 1280 x 720, 30 fps, 299 kbps (AAC-eld) Doorbell
[11/25/2021, 10:55:36 AM] [EufySecurity-1.0.6] DEBUG: Stream command: /usr/local/lib/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg -i  -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -f rawvideo -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale=trunc(iw/2)*2:trunc(ih/2)*2 -b:v 299k -payload_type 99 -ssrc 9240860 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params VUiTto6NyFm7DALbh+LbgdeIYJRQPv/8QbNdu3OQ srtp://192.168.1.57:64426?rtcpport=64426&pkt_size=1316 -vn -sn -dn -codec:a aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -ac 1 -payload_type 110 -ssrc 1944321 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 1OxbmPt06RK3wUmiHsFY1k/ejujHpbgcV5hCgiuI srtp://192.168.1.57:57009?rtcpport=57009&pkt_size=188 -loglevel level -progress pipe:1 Doorbell false
[11/25/2021, 10:55:36 AM] [EufySecurity-1.0.6] ERROR: FFmpeg exited with code: 1 and signal: null (Error) Doorbell
[11/25/2021, 10:55:36 AM] [EufySecurity-1.0.6] INFO:  Stopped video stream. Doorbell
[11/25/2021, 10:55:47 AM] [EufySecurity-1.0.6] DEBUG: Snapshot requested: 1280 x 720 Doorbell false
[11/25/2021, 10:55:47 AM] [EufySecurity-1.0.6] DEBUG: Snapshot command: /usr/local/lib/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg -i https://zhixin-security-eu.s3.eu-central-1.amazonaws.com/thumb/2021/11/25/station/T8010P2321063492/Yx08lgTSdRl2821e.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJYLV2KOLW6PU4FSA%2F20211125%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20211125T095241Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=688fc9659a3bb60a6b6780938bf52c47c83fd0c2b4b571ba3ed990eba22b287b -frames:v 1 -f image2 - -hide_banner -loglevel error Doorbell false
[11/25/2021, 10:55:47 AM] [EufySecurity-1.0.6] DEBUG: Fetching snapshot took 0.326 seconds. Doorbell false
[11/25/2021, 10:55:47 AM] [EufySecurity-1.0.6] DEBUG: Sending snapshot: 1280 x 720 Doorbell false
github-actions[bot] commented 2 years ago

Did you check this Common Issues pages ?

DavTechFr commented 2 years ago

Yes

mcarroll779 commented 2 years ago

I've got the same issue as well

schliemann commented 2 years ago

Awaiting input from @lenoxys

jubudu commented 2 years ago

Hello, I got the same issue.

I checked common issues page, updated everything and ran sudo npm i ffmpeg-for-homebridge -g with no errors.

Log when trying to stream: FFmpeg exited with code: 1 and signal: null (Error) Doorbell

mrota83 commented 2 years ago

same here was working well before updated to 1.0.6

taaa22 commented 2 years ago

Facing same issue!

voldzi commented 2 years ago

Unfortunately ...the same for me (also checked common issue...)

mmz06 commented 2 years ago

Hello, same issue here !!! (also checked common issue...) Reverting back to a few older versions the plugin (1.0.2, 1.0.3, 1.0.4) or Homebridge (v1.3.7 or v1.3.6) didn't help, BTW...

njuart commented 2 years ago

My Eufy 2k also stopped streaming, but snapshots are getting updated. Nothing specific in logs as I see

image

Kneudel commented 2 years ago

Same Issue here.

ffmpeg Version:

ffmpeg -version ffmpeg version 4.1.8-0+deb10u1+rpt1 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 8 (Raspbian 8.3.0-6+rpi1) configuration: --prefix=/usr --extra-version=0+deb10u1+rpt1 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-vout-drm --enable-v4l2-request --enable-libudev --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm 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

Deshmir commented 2 years ago

If you check the NPM addon by boprat (https://www.npmjs.com/package/eufy-security-client), there is now a v2 api with captcha authentication. I guess we need annupdate om the authentication: Example: https://github.com/bropat/eufy-security-client/blob/master/src/http/api.ts

Sebbl81 commented 2 years ago

I have the same issue like above.

bcblur commented 2 years ago

I have this, also. Looks to be because we have unquoted parens in the command line:

Current: ffmpeg -i -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -f rawvideo -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale=trunc(iw/2)2:trunc(ih/2)2 ...

This works on the command line: ffmpeg -i -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -f rawvideo -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale='trunc(iw/2)2:trunc(ih/2)2' ...

Source: https://github.com/samemory/homebridge-eufy-security/blob/1cfd5344ee9164b9c313d64338803646acf73a9b/src/accessories/streamingDelegate.ts#L172

Thanks for the great work, btw

voldzi commented 2 years ago

I have this, also. Looks to be because we have unquoted parens in the command line:

Current: ffmpeg -i -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -f rawvideo -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale=trunc(iw/2)2:trunc(ih/2)2 ...

This works on the command line: ffmpeg -i -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -f rawvideo -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale='trunc(iw/2)2:trunc(ih/2)2' ...

Source:

https://github.com/samemory/homebridge-eufy-security/blob/1cfd5344ee9164b9c313d64338803646acf73a9b/src/accessories/streamingDelegate.ts#L172

Thanks for the great work, btw

....and now only how to solve it :-) (thanks all!)

nanoupi42 commented 2 years ago

Hi, Same problem here, I don't have this file "streamingDelegate.ts". Any ideas ? :

Loatty commented 2 years ago

Any way to fix this? I am having the same problem

Deshmir commented 2 years ago

I tried the change that @bcblur suggested, but then it crashes. Moved the ‘ a bit back and forth, but no luck

bcblur commented 2 years ago

Yeah. It was only a partial fix. Mine still blows up. It looks like it doesn't like the first argument after each of the two URIs. I don't know FFMPEG well enough to do anything about this. Experimenting

eRWN commented 2 years ago

Hi everyone

Something strange today on my side

I jsut installed Hombridge and this hombridge-eufy-security plugin. The first time I launched the video in iOS Home application, the video stream was playing But next time I tried it didn't play anymore.

A trail...

On my side I looked what @bcblur was talking about

I have this, also. Looks to be because we have unquoted parens in the command line: Then I found the previous version of the line and found filters.push('scale=\'trunc(iw/2)*2\':\'trunc(ih/2)*2\''); // Force to fit encoder restrictions ( in src/accessories/streamingDelegate.ts previously at line 178 here : https://github.com/samemory/homebridge-eufy-security/commit/87217bf5c189f13d073924d170108a9b7fe6f886#diff-daa22098f16864aa4ded78d7957e2baaf5b1263c7e4a14d2f07a0bcb46c14c23 )

... that failed ?

@Deshmir, I'd like to know if that's what you exactly tried

I tried the change that @bcblur suggested, but then it crashes. Moved the ‘ a bit back and forth, but no luck And I would like to know if this previous version should be the solution

The solution ?

So correct current : filters.push('scale=trunc(iw/2)*2:trunc(ih/2)*2'); // Force to fit encoder restrictions to previous : filters.push('scale=\'trunc(iw/2)*2\':\'trunc(ih/2)*2\''); // Force to fit encoder restrictions

njuart commented 2 years ago

The solution ?

So correct current :

filters.push('scale=trunc(iw/2)*2:trunc(ih/2)*2'); // Force to fit encoder restrictions

to previous :

filters.push('scale=\'trunc(iw/2)*2\':\'trunc(ih/2)*2\''); // Force to fit encoder restrictions

Doesn't seem to work, nothing changed after replacing current line with older one. Still getting error in logs. What I did is: Changed line in StreamingDelegate.js -> Re-uploaded file to my RPi -> Restarted HB. But I might have done something wrong, not sure.

fullphat commented 2 years ago

Could you post the path to StreamingDelegate.js? I'll try it myself as well.

njuart commented 2 years ago

Could you post the path to StreamingDelegate.js? I'll try it myself as well.

In my setup I found it here

/usr/local/lib/node_modules/homebridge-eufy-security/dist/accessories/StreamingDelegate.js

Deshmir commented 2 years ago

@eRWN I've changed the following filters.push('scale=trunc(iw/2)*2:trunc(ih/2)*2'); //Froce to fit encoder restrictions to filters.push('scale='trunc(iw/2)*2':'trunc(ih/2)*2''); //Froce to fit encoder restrictions But that didn't seem to work.

If i paste entire error log from HB log in a terminal window /usr/lib/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg -i -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -f rawvideo -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale=trunc(iw/2)*2:trunc(ih/2)*2 -b:v 299k -payload_type 99 -ssrc 5664204 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params xxxxxxxxxxxxxxxxxxxxxxxxxxxxx srtp://192.168.185.224:55502?rtcpport=55502&pkt_size=1316 -vn -sn -dn -codec:a aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -ac 1 -payload_type 110 -ssrc 15147028 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params xxxxxxxxxxxxxxxxxxxxxxxxxx srtp://192.168.185.224:55975?rtcpport=55975&pkt_size=188 -loglevel level -progress pipe:1 Doorbell false The error that is outputed is syntax error near unexpected token (' So I added a couple of ' to encapsulate the scale: scale= 'trunc(iw/2)*2' : 'trunc(ih/2)*2' Which gives the error that "-vn" is unkown.

I'm kinda lost here now

Dravegon commented 2 years ago

found this: https://www.bountysource.com/issues/94450709-ffmpeg-exit-with-code-1-when-audio-is-enabled

might be an audio related problem, can somebody try homebridge-eufy-security version 0.2.13 (07-26-2021) as it is without audio on livestream my pi is kinda busy atm reinstalling FFMPEG(takes a while)

Deshmir commented 2 years ago

@dr @eRWN @davtechfr

I installed the beta version: homebridge-eufy-security v1.1.1-beta.2

Stream works again 👍

B83D7F20-38CC-4BEC-A755-4395224C4A3D

[11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] libavutil 56. 51.100 / 56. 51.100 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] libavcodec 58. 91.100 / 58. 91.100 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] libavformat 58. 45.100 / 58. 45.100 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] libavdevice 58. 10.100 / 58. 10.100 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] libavfilter 7. 85.100 / 7. 85.100 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] libswscale 5. 7.100 / 5. 7.100 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] libswresample 3. 7.100 / 3. 7.100 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] libpostproc 55. 7.100 / 55. 7.100 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [info] frame= 173 fps= 37 q=24.0 size= 166kB time=00:00:05.73 bitrate= 236.8kbits/s dup=86 drop=0 speed=1.23x
[11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Input #0, aac, from 'unix:./4.sock': [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Duration: N/A, bitrate: 23 kb/s [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Stream #0:0: Audio: aac (LC), 16000 Hz, mono, fltp, 23 kb/s [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Stream mapping: [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Stream #0:0 -> #0:0 (aac (native) -> aac (libfdk_aac)) [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Press [q] to stop, [?] for help [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [graph_0_in_0_0 @ 0x55f661b56500] [verbose] tb:1/16000 samplefmt:fltp samplerate:16000 chlayout:0x4 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [format_out_0_0 @ 0x55f661b54b40] [verbose] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_0' [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [auto_resampler_0 @ 0x55f661b44700] [verbose] ch:1 chl:mono fmt:fltp r:16000Hz -> ch:1 chl:mono fmt:s16 r:16000Hz [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Output #0, rtp, to 'srtp://192.168.185.224:53371?rtcpport=53371&pkt_size=188': [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Metadata: [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] encoder : Lavf58.45.100 [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Stream #0:0: Audio: aac (libfdk_aac) (ELD), 16000 Hz, mono, s16, delay 288, 24 kb/s [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] Metadata: [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] encoder : Lavc58.91.100 libfdk_aac [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [verbose] 1 dup! [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [verbose] 1 dup! [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [verbose] 1 dup! [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [verbose] 1 dup! [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [verbose] 1 dup! [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [verbose] 1 dup! [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [verbose] 1 dup! [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [verbose] 1 dup! [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio [info] size= 23kB time=00:00:06.70 bitrate= 28.3kbits/s speed=13.3x
[11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_audio Getting the first frames took 0.571 seconds. [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [verbose] *** 1 dup! [11/28/2021, 10:27:43 PM] [EufySecurity-1.1.1-beta.2] DEBUG: Doorbell_video [info] frame= 191 fps= 36 q=23.0 size= 187kB time=00:00:06.33 bitrate= 241.7kbits/s dup=95 drop=0 speed=1.21x `

njuart commented 2 years ago

@dr @eRWN

I installed the beta version: homebridge-eufy-security v1.1.1-beta.2

Stream works again 👍

But isn't beta crashing? Also, as I know fix related to devices disappearing wasn't pushed to beta, only to master.

Deshmir commented 2 years ago

@njuart I didn't know beta was/is crashing, at the moment just trying to figure out why the stream stopped working in the 1.0.6 version.

fullphat commented 2 years ago

I've been doing some testing of my own (thanks for the path to the file) and have removed all references to audio and resize filters, and I've swapped the codec to "copy" - basically replicating how my working camera in homebridge-ffmpeg looks. Still no success however, although I'm trying to make a floodlight work, not a doorbell.

bcblur commented 2 years ago

I hacked up the streamingDelegate.js file and managed to make all of the ffmpeg errors go away, but the stream still doesn't work. It hangs until it's cancelled. Will try updating to the beta build.

eRWN commented 2 years ago

Thanks @njuart for the path I didn't find before I tried a lot of things with quotes, double quote, escape char "\" but nothing did work (I had even more logs) @bcblur I also tried the beta but still the same result on my side (the stream doesn't work), say us if it works for you ;)

bcblur commented 2 years ago

No good for me either. Here's the patch for my changes to the streamingDelegate.js file I installed ffmpeg on my Win10 laptop and worked on the params until it no longer complained. Streaming still hangs, but it no longer errors out immediately.

streamingDelegate.js.patch.txt

andypburke commented 2 years ago

@njuart I didn't know beta was/is crashing, at the moment just trying to figure out why the stream stopped working in the 1.0.6 version.

On the beta version, the reason it seems to work is it is using the local livestream version (i.e. not going through the cloud) which is also why it is much faster to stream. The problem is it does crash, but I have managed to limit the impact by running the plugin in its own child bridge - meaning when it crashes it doesn't cause the homebridge to reboot.

I am running this (less than optimal) setup until the FFmpeg issue is resolved, but at least it enables the livestream. Not sure of the impact on doorbell push or anything else as yet.

Sebbl81 commented 2 years ago

I tested also the beta version. I have a Docker Installation on a Synology in a own child bridge with following error message (see attached file)

Bildschirmfoto 2021-11-29 um 15 34 42

OS | Alpine Linux (3.12.3) Node v14.15.5 NPM v7.18.1 Eufy Product: Eufy Battery Doorbell 2K

fullphat commented 2 years ago

No good for me either. Here's the patch for my changes to the streamingDelegate.js file I installed ffmpeg on my Win10 laptop and worked on the params until it no longer complained. Streaming still hangs, but it no longer errors out immediately. streamingDelegate.js.patch.txt

@bcblur I just applied your patch to 1.0.6 and now the thumb in Home app does update <3 but still no stream either

My logs now:

regularly

[11/29/2021, 3:46:22 PM] [EufySecurity-1.0.6] DEBUG: Snapshot requested: 1280 x 720 Doorbell false
[11/29/2021, 3:46:22 PM] [EufySecurity-1.0.6] DEBUG: Sending snapshot: 1280 x 720 (cached) Doorbell false
[11/29/2021, 3:46:22 PM] [EufySecurity-1.0.6] DEBUG: Resize command: ffmpeg -i pipe: -frames:v 1 -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease -f image2 - Doorbell false

when I open the stream

[11/29/2021, 3:46:22 PM] [EufySecurity-1.0.6] DEBUG: Video stream requested: 1280 x 720, 30 fps, 299 kbps Doorbell false
[11/29/2021, 3:46:22 PM] [EufySecurity-1.0.6] INFO:  Starting video stream: 1280 x 720, 30 fps, 299 kbps (AAC-eld) Doorbell
[11/29/2021, 3:46:22 PM] [EufySecurity-1.0.6] DEBUG: Stream command: ffmpeg -i  -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -f rawvideo -preset ultrafast -tune zerolatency 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 4833274 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params u6N7vQf+lH8XTmVWoBDPRKblTpinManzirAA/U4S -i srtp://192.168.1.29:64220?rtcpport=64220 -vn -sn -dn -codec:a aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -ac 1 -payload_type 110 -ssrc 7174974 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params d5zLb1jAGJSWCxddlSc0b7Tq5XMIrqIyPvUtaXvi -i srtp://192.168.1.29:60046?rtcpport=60046 -loglevel level -progress pipe:1 Doorbell false
[11/29/2021, 3:46:22 PM] [EufySecurity-1.0.6] ERROR: FFmpeg exited with code: 1 and signal: null (Error) Doorbell
[11/29/2021, 3:46:22 PM] [EufySecurity-1.0.6] INFO:  Stopped video stream. Doorbell

I think the issue is here:

"ffmpeg -i -an"

I'm sure ffmpeg expects something after the -i parameter, presumably a rtsp/rtmp URI?

bcblur commented 2 years ago

Played with it a bit and got streaming working for devices with RTSP enabled. I haven't figured out non-RTSP streaming devices. Looking at the debug logs, there doesn't appear to be a property that gives the location of a cloud streaming URL.

excuse my hackiness streamingDelegate.js.patch2.txt

^^^ updated the patch to eliminate some unhandled exceptions

MrTomAsh commented 2 years ago

@bcblur I can't see RTSP setup for the battery doorbell so I assume those are not included in your patch?

bcblur commented 2 years ago

Yeah. There’s no RTSP on the doorbell. Which sucks, because that’s the only device I need working. I might try some MITM traffic captures tomorrow with Burp to see what the web client does

bcblur commented 2 years ago

Upstream bug in the eufy-security-client module that's used here: https://github.com/fuatakgun/eufy_security/issues/126

**** ignore this. it was late and i confused tabs when i was looking at OSS eufy libraries

sluxtor commented 2 years ago

I am also dealing with this issue on my wired 2K doorbell. I thought it was cool when it worked, now I'm running through my head thinking why did I update? Always expecting the next update to allow for refreshed screenshots, but that's not nearly as necessary as having the live stream working!

schliemann commented 2 years ago

No need for people writing that streaming doesn't work on 1.0.6. We are aware. It was decided to fix the devices not found issue, since it would eventually affect everyone.

eulisef commented 2 years ago

Hi everyone

Something strange today on my side

I jsut installed Hombridge and this hombridge-eufy-security plugin. The first time I launched the video in iOS Home application, the video stream was playing But next time I tried it didn't play anymore.

A trail...

On my side I looked what @bcblur was talking about

I have this, also. Looks to be because we have unquoted parens in the command line: Then I found the previous version of the line and found filters.push('scale=\'trunc(iw/2)*2\':\'trunc(ih/2)*2\''); // Force to fit encoder restrictions ( in src/accessories/streamingDelegate.ts previously at line 178 here : 87217bf#diff-daa22098f16864aa4ded78d7957e2baaf5b1263c7e4a14d2f07a0bcb46c14c23 )

... that failed ?

@Deshmir, I'd like to know if that's what you exactly tried

I tried the change that @bcblur suggested, but then it crashes. Moved the ‘ a bit back and forth, but no luck And I would like to know if this previous version should be the solution

The solution ?

So correct current : filters.push('scale=trunc(iw/2)*2:trunc(ih/2)*2'); // Force to fit encoder restrictions to previous : filters.push('scale=\'trunc(iw/2)*2\':\'trunc(ih/2)*2\''); // Force to fit encoder restrictions

tried this with no success. i modified the streamingdelegate.js file with this, restarted homebridge service but still getting the same error

eulisef commented 2 years ago

enabled debug mode and here is the extract for both cases (first when opening Home App when a snapshot is requested and then when trying to load livestream):

[12/3/2021, 11:34:46 AM] [EufySecurity-1.0.6] DEBUG: Eufy Doorbell GET StationCurrentMode: { value: 1, timestamp: 1638497679000 } [12/3/2021, 11:34:46 AM] [EufySecurity-1.0.6] DEBUG: Eufy Doorbell GET StationGuardMode: { value: 1, timestamp: 1638497679000 } [12/3/2021, 11:34:46 AM] [EufySecurity-1.0.6] DEBUG: Doorbell GET DeviceEnabled: { value: true, timestamp: 1638488231000 } [12/3/2021, 11:34:46 AM] [EufySecurity-1.0.6] DEBUG: Doorbell GET DeviceMotionDetected: { value: false, timestamp: 0 } [12/3/2021, 11:34:46 AM] [EufySecurity-1.0.6] DEBUG: Doorbell GET DeviceMotionDetection: { value: true, timestamp: 1638488231000 } [12/3/2021, 11:34:46 AM] [EufySecurity-1.0.6] DEBUG: Snapshot requested: 1280 x 720 Doorbell false [12/3/2021, 11:34:46 AM] [EufySecurity-1.0.6] DEBUG: Snapshot command: /usr/lib/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg -i URL -frames:v 1 -f image2 - -hide_banner -loglevel error Doorbell false [12/3/2021, 11:34:47 AM] [EufySecurity-1.0.6] DEBUG: Fetching snapshot took 0.661 seconds. Doorbell false [12/3/2021, 11:34:47 AM] [EufySecurity-1.0.6] DEBUG: Sending snapshot: 1280 x 720 Doorbell false [12/3/2021, 11:34:47 AM] [EufySecurity-1.0.6] DEBUG: Resize command: /usr/lib/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg -i pipe: -frames:v 1 -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease -f image2 - Doorbell false [12/3/2021, 11:34:54 AM] [EufySecurity-1.0.6] DEBUG: Video stream requested: 1280 x 720, 30 fps, 299 kbps Doorbell false [12/3/2021, 11:34:54 AM] [EufySecurity-1.0.6] INFO: Starting video stream: 1280 x 720, 30 fps, 299 kbps (AAC-eld) Doorbell [12/3/2021, 11:34:54 AM] [EufySecurity-1.0.6] DEBUG: Stream command: /usr/lib/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg -i -an -sn -dn -codec:v libx264 -pix_fmt yuv420p -color_range mpeg -r 30 -f rawvideo -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale='trunc(iw/2)2':'trunc(ih/2)2' -b:v 299k -payload_type 99 -ssrc 10720596 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params Qx3SNqf79LgSdcm/qXPb5Suc2nifACnGkI/rXV8y srtp://ip:63518?rtcpport=63518&pkt_size=1316 -vn -sn -dn -codec:a aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -ac 1 -payload_type 110 -ssrc 591380 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params c/TLQ3GXI6akq7wpfhrOqYGZ3kfA9r5KRZVWIRqC srtp://ip:49497?rtcpport=49497&pkt_size=188 -loglevel level -progress pipe:1 Doorbell false [12/3/2021, 11:34:54 AM] [EufySecurity-1.0.6] ERROR: FFmpeg exited with code: 1 and signal: null (Error) Doorbell [12/3/2021, 11:34:54 AM] [EufySecurity-1.0.6] INFO: Stopped video stream. Doorbell

eulisef commented 2 years ago

i redacted the logs and removed the snapshot URL and the IP addresses..... but i noticed that the snapshot URL does not change. when i open a browser and go to that site it has a really old snapshot JPG file..... maybe there is an issue in the fact that snapshot URLs are not being updated so it always uses the same 'cached' one?

taaa22 commented 2 years ago

Dear @samemory @lenoxys @schliemann Thanks for the awesome plug-in. I don't know if you are aware or not, the plug-in has steaming issue. Any update or fix is coming soon?

AppleNips commented 2 years ago

I am having the same issue.

aklausing commented 2 years ago

The same issue here. HomeBridge in docker. Also tried to move back to an older version of the container image. No chance. Stream isn't working with 1.0.6 ... plugin is crashing with 1.1.1 beta.

Insomniac86 commented 2 years ago

The same issue here. HomeBridge in docker. Also tried to move back to an older version of the container image. No chance. Stream isn't working with 1.0.6 ... plugin is crashing with 1.1.1 beta.

Yes to everything you said, same here.

chazeon commented 2 years ago

The streaming URL cannot be resolved. See there is nothing after ffmpeg -i. This is related to an upstream issue. See https://github.com/bropat/eufy-security-client/issues/79 for workaround etc.

bcblur commented 2 years ago

The streaming URL cannot be resolved. See there is nothing after ffmpeg -i. This is related to an upstream issue. See bropat/eufy-security-client#79 for workaround etc.

confirmed for me. comment out line 47 in node_modules/homebridge-eufy-security/node_modules/eufy-security-client/build/http/api.js

i'm using it with my other patches above. didn't bother backing out my changes.