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
638 stars 92 forks source link

Raspberry PI completely freezes when initializing #870

Open BernardoEstrada opened 9 months ago

BernardoEstrada commented 9 months ago

Describe the bug Homebridge starts and works ok on my docker container but a bit after camera.ui starts my whole rapberry pi completely freezes. I have to unplug it and plug it back in.

This happened with the camera.ui container by itself too.

Homebridge in my docker compose

  homebridge:
    container_name: homebridge
    image: homebridge/homebridge:latest
    restart: "no"
    network_mode: host
    volumes:
      - ./homebridge:/homebridge
    logging:
      driver: json-file
      options:
        max-size: '10m'
        max-file: '1'
    healthcheck:
      test: curl --fail localhost:8581 || exit 1
      interval: 60s
      retries: 5
      start_period: 300s
      timeout: 2s

To Reproduce docker compose up homebridge -u Install camera.ui in homebridge interface Restart homebridge

Logs

Logs ``` docker logs -f --details homebridge s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service tzupdate: starting s6-rc: info: service setup: starting s6-rc: info: service credits: starting Thank you for using the homebridge/homebridge docker image! If you find this project useful please STAR it on GitHub: https://github.com/homebridge/docker-homebridge Or donate to the project: https://github.com/sponsors/oznu https://paypal.me/oznu s6-rc: info: service credits successfully started s6-rc: info: service fix-attrs successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started Set system timezone to America/Mexico_City. s6-rc: info: service tzupdate successfully started Installing Homebridge and user plugins, please wait... up to date in 7s s6-rc: info: service setup successfully started s6-rc: info: service userdata: starting s6-rc: info: service dbus: starting s6-rc: info: service dbus successfully started s6-rc: info: service avahi: starting Starting dbus-daemon Executing user startup script /homebridge/startup.sh s6-rc: info: service avahi successfully started Starting Avahi daemon Found user 'avahi' (UID 105) and group 'avahi' (GID 108). s6-rc: info: service userdata successfully started s6-rc: info: service homebridge: starting s6-rc: info: service homebridge successfully started s6-rc: info: service homebridge-log: starting s6-rc: info: service homebridge-log successfully started s6-rc: info: service legacy-services: starting Successfully dropped root privileges. avahi-daemon 0.8 starting up. [11/26/2023, 11:40:44 PM] [CameraUI] tapo_179: Configuring unbridged accessory... [11/26/2023, 11:40:44 PM] [CameraUI] tapo_179: Setting up accessory... [11/26/2023, 11:40:44 PM] [CameraUI] tapo_179: Adding motion sensor service (HSV) [11/26/2023, 11:40:44 PM] [CameraUI] tapo_179: Initializing HomeKit Secure Video [11/26/2023, 11:40:44 PM] [CameraUI] Accessories refreshed and config.json saved! [11/26/2023, 11:40:45 PM] tapo_179 1548 is running on port 46541. [11/26/2023, 11:40:45 PM] Please add [tapo_179 1548] manually in Home app. Setup Code: 000-00-000 [11/26/2023, 11:40:58 PM] [CameraUI] Configuring socket... [11/26/2023, 11:40:58 PM] [CameraUI] Configuring database... [11/26/2023, 11:40:59 PM] [CameraUI] Configuring event controller... dbus_bus_get_private(): Failed to connect to socket /run/dbus/system_bus_socket: Connection refused WARNING: Failed to contact D-Bus daemon. avahi-daemon 0.8 exiting. s6-rc: info: service legacy-services successfully started Starting Avahi daemon Found user 'avahi' (UID 105) and group 'avahi' (GID 108). Successfully dropped root privileges. avahi-daemon 0.8 starting up. No service file found in /etc/avahi/services. *** WARNING: Detected another IPv4 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. *** Joining mDNS multicast group on interface docker0.IPv4 with address 172.17.0.1. New relevant interface docker0.IPv4 for mDNS. Joining mDNS multicast group on interface eth0.vlan.IPv4 with address . New relevant interface eth0.vlan.IPv4 for mDNS. Joining mDNS multicast group on interface wlan0.IPv4 with address . New relevant interface wlan0.IPv4 for mDNS. Joining mDNS multicast group on interface eth0.IPv4 with address . New relevant interface eth0.IPv4 for mDNS. Joining mDNS multicast group on interface lo.IPv4 with address 127.0.0.1. New relevant interface lo.IPv4 for mDNS. Network interface enumeration completed. Registering new address record for 172.17.0.1 on docker0.IPv4. Registering new address record for :::: on eth0.vlan.*. Registering new address record for on eth0.vlan.IPv4. Registering new address record for ::::: on wlan0.*. Registering new address record for ::::: on wlan0.*. Registering new address record for on wlan0.IPv4. Registering new address record for ::::: on eth0.*. Registering new address record for on eth0.IPv4. Registering new address record for ::::: on lo.*. Registering new address record for 127.0.0.1 on lo.IPv4. Failed to parse address ':::::%wlan0', ignoring. Failed to parse address ':::::%wlan0', ignoring. Server startup complete. Host name is raspberrypi.local. Local service cookie is 3482666654. [11/26/2023, 11:53:20 PM] [HB Supervisor] Homebridge Storage Path: /var/lib/homebridge [11/26/2023, 11:53:20 PM] [HB Supervisor] Homebridge Config Path: /var/lib/homebridge/config.json [11/26/2023, 11:53:20 PM] [HB Supervisor] Logging to /var/lib/homebridge/homebridge.log [11/26/2023, 11:53:20 PM] [HB Supervisor] OS: Linux 6.1.0-rpi6-rpi-v8 arm64 [11/26/2023, 11:53:20 PM] [HB Supervisor] Node.js v18.18.2 /opt/homebridge/bin/node [11/26/2023, 11:53:20 PM] [HB Supervisor] Homebridge Path: /var/lib/homebridge/node_modules/homebridge/bin/homebridge [11/26/2023, 11:53:20 PM] [HB Supervisor] UI Path: /opt/homebridge/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js [11/26/2023, 11:53:31 PM] [Homebridge UI] Homebridge UI v4.53.0 is listening on ::::: port 8581 [11/26/2023, 11:53:32 PM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /var/lib/homebridge/node_modules --strict-plugin-resolution [11/26/2023, 11:53:32 PM] [HB Supervisor] Started Homebridge v1.7.0 with PID: 149 [11/26/2023, 11:53:34 PM] Loaded config.json with 0 accessories and 2 platforms. [11/26/2023, 11:53:35 PM] Loaded 0 cached accessories from cachedAccessories. [11/26/2023, 11:53:35 PM] --- [11/26/2023, 11:53:36 PM] Loaded plugin: homebridge-camera-ui@5.0.27 [11/26/2023, 11:53:36 PM] Registering platform 'homebridge-camera-ui.CameraUI' [11/26/2023, 11:53:36 PM] --- [11/26/2023, 11:53:36 PM] Loading 2 platforms... [11/26/2023, 11:53:36 PM] [CameraUI] Initializing CameraUI platform... [11/26/2023, 11:53:36 PM] [CameraUI] Config changed through interface, saving... [11/26/2023, 11:53:36 PM] [CameraUI] Initializing camera.ui with PID: 149 [11/26/2023, 11:53:36 PM] [CameraUI] Configuring server... Setup Payload: X-HM://0024GOJUAIKRT Enter this code with your HomeKit app on your iOS device to pair with Homebridge: ┌────────────┐ │ 000-00-000 │ └────────────┘ [11/26/2023, 11:53:36 PM] Homebridge v1.7.0 (HAP v0.11.1) (Homebridge E546) is running on port 51455. [11/26/2023, 11:53:36 PM] [CameraUI] tapo_179: Configuring unbridged accessory... [11/26/2023, 11:53:36 PM] [CameraUI] tapo_179: Setting up accessory... [11/26/2023, 11:53:36 PM] [CameraUI] tapo_179: Adding motion sensor service (HSV) [11/26/2023, 11:53:36 PM] [CameraUI] tapo_179: Initializing HomeKit Secure Video [11/26/2023, 11:53:37 PM] [CameraUI] Accessories refreshed and config.json saved! [11/26/2023, 11:53:37 PM] tapo_179 1548 is running on port 39073. [11/26/2023, 11:53:37 PM] Please add [tapo_179 1548] manually in Home app. Setup Code: 000-00-000 [11/26/2023, 11:53:51 PM] [CameraUI] Configuring socket... [11/26/2023, 11:53:51 PM] [CameraUI] Configuring database... [11/26/2023, 11:53:51 PM] [CameraUI] Configuring event controller... [11/26/2023, 11:53:56 PM] [CameraUI] Configuring motion controller... [11/26/2023, 11:53:56 PM] [CameraUI] Configuring camera controller... [11/26/2023, 11:53:56 PM] [CameraUI] tapo_179: Setting up camera, please be patient... [11/26/2023, 11:53:56 PM] [CameraUI] tapo_179: Probe stream: ffmpeg -analyzeduration 0 -probesize 5000 -i rtsp://usr:pwd@ip:554/stream1 [11/26/2023, 11:53:58 PM] [CameraUI] tapo_179: {"ffmpegVersion":"6.0-homebridge-alpine-aarch64-static","probe":true,"timedout":false,"audio":["pcm_alaw","8000 Hz","mono","s16","64 kb/s"],"video":["h264 (Main)","yuv420p(tv","bt709","progressive)","1920x1080","15 tbr","90k tbn"],"bitrate":"64 kb/s","mapvideo":"0:0","mapaudio":"0:1"} [11/26/2023, 11:53:58 PM] [CameraUI] Starting interface... [11/26/2023, 11:53:58 PM] [CameraUI] camera.ui v5.0.27 is listening on port 8081 (http) [11/26/2023, 11:54:53 PM] [Homebridge UI] [homebridge-camera-ui] Incoming Request: /interfaceConfig [11/26/2023, 11:55:04 PM] [Homebridge UI] [homebridge-camera-ui] Incoming Request: /cameras [11/26/2023, 11:55:04 PM] [Homebridge UI] [homebridge-camera-ui] tapo_179: Probe stream: ffmpeg -analyzeduration 0 -probesize 5000 -i rtsp://usr:pwd@ip:554/stream1 [11/26/2023, 11:55:06 PM] [Homebridge UI] [homebridge-camera-ui] tapo_179: {"ffmpegVersion":"6.0-homebridge-alpine-aarch64-static","probe":true,"timedout":false,"audio":["pcm_alaw","8000 Hz","mono","s16","64 kb/s"],"video":["h264 (Main)","yuv420p(tv","bt709","progressive)","1920x1080","15 tbr","90k tbn"],"bitrate":"64 kb/s","mapvideo":"0:0","mapaudio":"0:1"} [11/26/2023, 11:55:10 PM] [Homebridge UI] [homebridge-camera-ui] Incoming Request: /startStream [11/26/2023, 11:55:10 PM] [Homebridge UI] [homebridge-camera-ui] tapo_179: Stream command: ffmpeg -hide_banner -loglevel error -rtsp_transport tcp -i rtsp://usr:pwd@ip:554/stream1 -f mpegts -vcodec mpeg1video -s 1280x720 -b:v 299k -r 20 -bf 0 -preset:v ultrafast -threads 1 -an -q 1 -max_muxing_queue_size 9999 - [11/26/2023, 11:55:22 PM] [Homebridge UI] [homebridge-camera-ui] Incoming Request: /stopStreams [11/26/2023, 11:55:22 PM] [Homebridge UI] [homebridge-camera-ui] tapo_179: Stopping stream.. [11/26/2023, 11:55:22 PM] [Homebridge UI] [homebridge-camera-ui] tapo_179: Stream Exit (expected) [11/26/2023, 11:55:28 PM] [Homebridge UI] [homebridge-camera-ui] Incoming Request: /cameras [11/26/2023, 11:55:28 PM] [Homebridge UI] [homebridge-camera-ui] tapo_179: Probe stream: ffmpeg -analyzeduration 0 -probesize 5000 -i rtsp://usr:pwd@ip:554/stream1 [11/26/2023, 11:55:30 PM] [Homebridge UI] [homebridge-camera-ui] tapo_179: {"ffmpegVersion":"6.0-homebridge-alpine-aarch64-static","probe":true,"timedout":false,"audio":["pcm_alaw","8000 Hz","mono","s16","64 kb/s"],"video":["h264 (Main)","yuv420p(tv","bt709","progressive)","1920x1080","15 tbr","90k tbn"],"bitrate":"64 kb/s","mapvideo":"0:0","mapaudio":"0:1"} [11/26/2023, 11:55:32 PM] [Homebridge UI] [homebridge-camera-ui] Incoming Request: /startStream [11/26/2023, 11:55:32 PM] [Homebridge UI] [homebridge-camera-ui] tapo_179: Stream command: ffmpeg -hide_banner -loglevel error -rtsp_transport tcp -i rtsp://usr:pwd@ip:554/stream1 -f mpegts -vcodec mpeg1video -s 1280x720 -b:v 299k -r 20 -bf 0 -preset:v ultrafast -threads 1 -an -q 1 -max_muxing_queue_size 9999 - ```

Screenshots This is the only screenshot I could grab, it's the 2 highest processes of htop after the pi froze CleanShot 2023-11-26 at 22 38 02

Environment

BernardoEstrada commented 9 months ago

My camera.ui config

{
  "logLevel": "debug",
  "port": 8081,
  "atHomeSwitch": false,
  "options": {
    "videoProcessor": "ffmpeg"
  },
  "ssl": {
    "active": false
  },
  "http": {
    "active": false,
    "port": 7272,
    "localhttp": false
  },
  "smtp": {
    "active": false,
    "port": 2727,
    "space_replace": "+"
  },
  "ftp": {
    "active": false,
    "useFile": false,
    "port": 5050
  },
  "mqtt": {
    "active": false,
    "tls": false,
    "port": 1883
  },
  "cameras": [
    {
      "name": "tapo_179",
      "motion": false,
      "motionTimeout": 15,
      "unbridge": true,
      "hsv": true,
      "prebuffering": false,
      "prebufferLength": 4,
      "videoConfig": {
        "source": "-i  rtsp://usr:pass@ip:554/stream1",
        "subSource": "-i  rtsp://usr:pass@ip:554/stream2",
        "stillImageSource": "-i  rtsp://usr:pass@ip:554/stream1",
        "rtspTransport": "tcp",
        "vcodec": "copy",
        "acodec": "libfdk_aac",
        "audio": true
      },
      "smtp": {
        "email": "tapo_179"
      },
      "videoanalysis": {
        "active": false
      },
      "mqtt": {},
      "recordOnMovement": false
    }
  ]
}
BernardoEstrada commented 9 months ago

I think I might have narrowed down the problem to ffmpeg, as this also happens in Camera.ui, Scrypted and HomeAssistant using the ONVIF plugin. However this doesn't happen when running it on the command line

tekdope commented 9 months ago

Experiencing the exact same issue since the latest Homebridge update.

mkz212 commented 1 month 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).