seydx / homebridge-camera-ui

Homebridge plugin for RTSP Cameras with HSV, motion detection support, Image Rekognition, Web UI to manage/watch streams and WebApp support
MIT License
657 stars 91 forks source link

Can not start video analysis, camera not reachable. Trying again in 60s.. #701

Open FezVrasta opened 1 year ago

FezVrasta commented 1 year ago

Describe the bug The camera does not show up in Apple Home and I get this error:

[CameraUI]  WARNING  Sala Cam: Can not start video analysis, camera not reachable. Trying again in 60s..

If I open the stream from the Homebridge Camera UI interface it opens correctly, but if I open it from the Camera UI web interface it tells the camera is offline and I get this error on the browser console:

CleanShot 2022-12-15 at 12 32 46@2x

If I go to /settings/cameras and then open the Videoanalysis section, I can see the camera stream properly.

I tried to directly ping from node using nodejs-tcp-ping and I get the same ping error, if I use the unix ping utility everything works correctly though.

If I replace that package with icmp the ping succeeds though, the problem is that the package doesn't seem to work on the unprivileged user used by Homebridge on DSM. I was able to workaround the issue by making the ping command always return true so far. Shortly after I realized by NAS is not powerful enough to support this so I removed it 🤷‍♂️

To Reproduce I'm using this configuration:

 {
    "name": "Sala Cam",
    "manufacturer": "Wyze",
    "model": "Wyze Cam Pan",
    "serialNumber": "xxxxxxxxxx",
    "motion": true,
    "motionTimeout": 15,
    "unbridge": true,
    "hsv": true,
    "prebuffering": false,
    "prebufferLength": 4,
    "videoConfig": {
        "source": "-i rtsp://wyze:xxxxxxxx@10.0.0.15/live",
        "subSource": "-i rtsp://wyze:xxxxxxxx@10.0.0.15/live",
        "stillImageSource": "-i rtsp://wyze:xxxxxxxx@10.0.0.15/live",
        "maxStreams": 1,
        "vcodec": "copy",
        "acodec": "libfdk_aac",
        "audio": true
    },
    "smtp": {
        "email": "Sala Cam"
    },
    "videoanalysis": {
        "active": true
    },
    "mqtt": {}
}

Expected behavior

Camera should work.

Logs

[12/15/2022, 3:43:44 AM] [CameraUI] Sala Cam: Setting up camera, please be patient...
[12/15/2022, 3:43:44 AM] [CameraUI] Sala Cam: Probe stream: /opt/bin/ffmpeg -analyzeduration 0 -probesize 5000 -i rtsp://wyze:xxxxxxxx@10.0.0.15/live
[12/15/2022, 3:43:45 AM] [CameraUI] Sala Cam: {"ffmpegVersion":"5.0.1","probe":true,"timedout":false,"audio":["pcm_alaw","8000 Hz","mono","s16","64 kb/s"],"video":["h264","yuv420p(progressive)","1920x1080","15 tbr","90k tbn"],"bitrate":"64 kb/s","mapvideo":"0:0","mapaudio":"0:1"}
[12/15/2022, 3:43:45 AM] [CameraUI] Sala Cam: Incoming ping request for: rtsp://wyze:xxxxxxxx@10.0.0.15/live - Timeout: 1s
[12/15/2022, 3:43:45 AM] [CameraUI] Sala Cam: Pinging 10.0.0.15:80
[12/15/2022, 3:43:45 AM] [CameraUI] Sala Cam: Pinging 10.0.0.15:80 - failed
[12/15/2022, 3:43:45 AM] [CameraUI]  WARNING  Sala Cam: Can not start video analysis, camera not reachable. Trying again in 60s..
❯ ping 10.0.0.15                                 
PING 10.0.0.15 (10.0.0.15): 56 data bytes
64 bytes from 10.0.0.15: icmp_seq=0 ttl=64 time=9.277 ms
64 bytes from 10.0.0.15: icmp_seq=1 ttl=64 time=6.607 ms
❯ /opt/bin/ffmpeg -y -i rtsp://wyze:xxxxxxxx@10.0.0.15/live -vframes 1 test.jpg
ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 8.4.0 (OpenWrt GCC 8.4.0 r2013-4a3ee6da)
  configuration: --enable-cross-compile --cross-prefix=aarch64-openwrt-linux-gnu- --arch=aarch64 --cpu=cortex-a53 --target-os=linux --prefix=/opt --pkg-config=pkg-config --enable-shared --enable-static --enable-pthreads --enable-zlib --disable-doc --disable-debug --disable-lzma --disable-vaapi --disable-vdpau --disable-outdevs --disable-runtime-cpudetect --enable-lto --enable-neon --enable-vfp --disable-x86asm --enable-gnutls --enable-libopus --enable-small --enable-libmp3lame --enable-gpl --enable-libx264
  libavutil      57. 17.100 / 57. 17.100
  libavcodec     59. 18.100 / 59. 18.100
  libavformat    59. 16.100 / 59. 16.100
  libavdevice    59.  4.100 / 59.  4.100
  libavfilter     8. 24.100 /  8. 24.100
  libswscale      6.  4.100 /  6.  4.100
  libswresample   4.  3.100 /  4.  3.100
  libpostproc    56.  3.100 / 56.  3.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://wyze:xxxxxxxx@10.0.0.15/live':
  Metadata:
    title           : Session streamed by the WYZE Media Server
    comment         : live
  Duration: N/A, start: 0.003500, bitrate: N/A
  Stream #0:0: Video: h264, yuv420p(progressive), 1920x1080, 15 fps, 15.17 tbr, 90k tbn
  Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0x2faf7fb0] [swscaler @ 0x2fb04f40] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2faf7fb0] [swscaler @ 0x302aa0a0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2faf7fb0] [swscaler @ 0x302f3c50] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2faf7fb0] [swscaler @ 0x3033e8f0] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 0x2faf7fb0] [swscaler @ 0x3038a680] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'test.jpg':
  Metadata:
    title           : Session streamed by the WYZE Media Server
    comment         : live
    encoder         : Lavf59.16.100
  Stream #0:0: Video: mjpeg, yuvj420p(pc, progressive), 1920x1080, q=2-31, 200 kb/s, 15.17 fps, 15.17 tbn
    Metadata:
      encoder         : Lavc59.18.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=5.7 Lsize=N/A time=00:00:00.06 bitrate=N/A dup=1 drop=1 speed=0.0915x    
video:45kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

The above command properly outputs a picture taken from my webcam.

Screenshots If applicable, add screenshots to help explain your problem.

Environment

stale[bot] commented 1 year 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.

FezVrasta commented 1 year ago

Don't close this issue. This is an automatic message by Fresh - a bot against stale bots.

stale[bot] commented 1 year 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.

FezVrasta commented 1 year ago

Don't close this issue. This is an automatic message by Fresh - a bot against stale bots.

stale[bot] commented 1 year 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.

FezVrasta commented 1 year ago

Don't close this issue. This is an automatic message by Fresh - a bot against stale bots.

stale[bot] commented 1 year 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.

FezVrasta commented 1 year ago

Don't close this issue. This is an automatic message by Fresh - a bot against stale bots.

mkz212 commented 4 months ago

🎉 A new version of camera.ui

A new version of camera.ui is currently under active development. An initial alpha/beta release and previews are coming soon. Stay tuned for exciting updates: https://github.com/seydx/camera.ui/issues/448 .

This version will no longer be developed / fixed. The new version contains many novelties and fixes (most important is for HKSV recording).