home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.15k stars 29.83k forks source link

Synology Surveillance Station: Uncaught thread exception, Invalid argument: '<none>'; last error log: [mp4] dimensions not set #123114

Open charlespick opened 1 month ago

charlespick commented 1 month ago

The problem

Camera streams from Synology Surveillance Station integration will not start, or take over 60 seconds to start. In the Home Assistant Log, the error "Invalid argument: ''; last error log: [mp4] dimensions not set" posts every time you try to view a camera in the frontend.

What version of Home Assistant Core has the issue?

2024.7.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

Synology DSM

Link to integration documentation on our website

https://www.home-assistant.io/integrations/synology_dsm/

Diagnostics information

{
  "home_assistant": {
    "installation_type": "Home Assistant Core",
    "version": "2024.7.2",
    "dev": false,
    "hassio": false,
    "virtualenv": true,
    "python_version": "3.12.3",
    "docker": false,
    "arch": "x86_64",
    "timezone": "America/Phoenix",
    "os_name": "Linux",
    "os_version": "5.15.0-116-generic",
    "run_as_root": false
  },
  "custom_components": {},
  "integration_manifest": {
    "domain": "synology_dsm",
    "name": "Synology DSM",
    "codeowners": [
      "hacf-fr",
      "Quentame",
      "mib1185"
    ],
    "config_flow": true,
    "dependencies": [
      "http"
    ],
    "documentation": "https://www.home-assistant.io/integrations/synology_dsm",
    "iot_class": "local_polling",
    "loggers": [
      "synology_dsm"
    ],
    "requirements": [
      "py-synologydsm-api==2.4.4"
    ],
    "ssdp": [
      {
        "manufacturer": "Synology",
        "deviceType": "urn:schemas-upnp-org:device:Basic:1"
      }
    ],
    "zeroconf": [
      {
        "type": "_http._tcp.local.",
        "properties": {
          "vendor": "synology*"
        }
      }
    ],
    "is_built_in": true
  },
  "setup_times": {
    "null": {
      "setup": 2.5071902200579643e-05
    },
    "01J3VGTT7989CAH5XPRVG9NJ9Z": {
      "wait_import_platforms": -0.015691008884459734,
      "wait_base_component": -0.008522325893864036,
      "config_entry_setup": 9.767367422115058
    }
  },
  "data": {
    "entry": {
      "data": {
        "host": "nvr01.makerland.xyz",
        "port": "443",
        "ssl": true,
        "verify_ssl": true,
        "username": "**REDACTED**",
        "password": "**REDACTED**",
        "mac": [
          "**REDACTED**"
        ],
        "device_token": "**REDACTED**"
      },
      "disabled_by": null,
      "domain": "synology_dsm",
      "entry_id": "01J3VGTT7989CAH5XPRVG9NJ9Z",
      "minor_version": 1,
      "options": {},
      "pref_disable_new_entities": false,
      "pref_disable_polling": false,
      "source": "user",
      "title": "nvr01.makerland.xyz",
      "unique_id": "2370UKR79R1H7",
      "version": 1
    },
    "device_info": {
      "model": "DS223j",
      "version": "DSM 7.2.1-69057 Update 5",
      "ram": 1024,
      "uptime": 358222,
      "temperature": 39
    },
    "network": {
      "interfaces": {
        "eth0": {
          "type": "lan",
          "ip": [
            {
              "address": "10.3.3.**REDACTED**",
              "netmask": "255.255.255.0"
            }
          ]
        }
      }
    },
    "storage": {
      "disks": {
        "sata1": {
          "name": "Drive 1",
          "vendor": "Synology",
          "model": "HAT3300-4T",
          "device": "/dev/sata1",
          "temp": 35,
          "size_total": "4000787030016"
        },
        "sata2": {
          "name": "Drive 2",
          "vendor": "Synology",
          "model": "HAT3300-4T",
          "device": "/dev/sata2",
          "temp": 37,
          "size_total": "4000787030016"
        }
      },
      "volumes": {
        "volume_1": {
          "name": "btrfs",
          "size": {
            "free_inode": "0",
            "total": "3829365997568",
            "total_device": "3988950876160",
            "total_inode": "0",
            "used": "476169977856"
          }
        }
      }
    },
    "surveillance_station": {
      "cameras": {
        "1": {
          "name": "Portercam",
          "is_enabled": true,
          "is_motion_detection_enabled": true,
          "model": "IP2M-841B",
          "resolution": "1920x1080"
        },
        "2": {
          "name": "Doorbell",
          "is_enabled": true,
          "is_motion_detection_enabled": true,
          "model": "Video Doorbell WiFi",
          "resolution": "2560x1920"
        }
      },
      "camera_diagnostics": {
        "camera.portercam": {
          "start_worker": 2,
          "keepalive": false,
          "orientation": 1,
          "container_format": "rtsp",
          "video_codec": "h264"
        },
        "camera.doorbell": {}
      }
    },
    "upgrade": {
      "update_available": false,
      "available_version": null,
      "reboot_needed": null,
      "service_restarts": null
    },
    "utilisation": {
      "cpu": {
        "15min_load": 26,
        "1min_load": 90,
        "5min_load": 43,
        "device": "System",
        "other_load": 11,
        "system_load": 4,
        "user_load": 5
      },
      "memory": {
        "avail_real": 140360,
        "avail_swap": 1745336,
        "buffer": 10952,
        "cached": 591288,
        "device": "Memory",
        "memory_size": 1048576,
        "real_usage": 25,
        "si_disk": 4,
        "so_disk": 4,
        "swap_usage": 16,
        "total_real": 991744,
        "total_swap": 2097084
      },
      "network": [
        {
          "device": "total",
          "rx": 725928,
          "tx": 22967
        },
        {
          "device": "eth0",
          "rx": 725928,
          "tx": 22967
        }
      ]
    },
    "is_system_loaded": true,
    "api_details": {
      "fetching_entities": {
        "SYNO.Core.SecurityScan.Status": [
          "2370UKR79R1H7_SYNO.Core.SecurityScan.Status:status"
        ],
        "SYNO.Storage.CGI.Storage": [
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_exceed_bad_sector_thr_sata1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_temp_sata2",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_exceed_bad_sector_thr_sata2",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:volume_disk_temp_avg_volume_1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_temp_sata1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_status_sata1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_below_remain_life_thr_sata1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_status_sata2",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:volume_size_used_volume_1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:volume_percentage_used_volume_1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:volume_status_volume_1",
          "2370UKR79R1H7_SYNO.Storage.CGI.Storage:disk_below_remain_life_thr_sata2"
        ],
        "SYNO.Core.System.Utilization": [
          "2370UKR79R1H7_SYNO.Core.System.Utilization:cpu_15min_load",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:cpu_5min_load",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:network_up",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_real_usage",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:cpu_user_load",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_available_swap",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_total_real",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_available_real",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:network_down",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:memory_total_swap",
          "2370UKR79R1H7_SYNO.Core.System.Utilization:cpu_total_load"
        ],
        "SYNO.DSM.Info": [
          "2370UKR79R1H7_SYNO.DSM.Info:temperature"
        ],
        "SYNO.SurveillanceStation.HomeMode": [
          "2370UKR79R1H7_SYNO.SurveillanceStation.HomeMode:home_mode"
        ],
        "SYNO.Core.Upgrade": [
          "2370UKR79R1H7_SYNO.Core.Upgrade:update"
        ],
        "SYNO.SurveillanceStation.Camera": [
          "2370UKR79R1H7_SYNO.SurveillanceStation.Camera:1",
          "2370UKR79R1H7_SYNO.SurveillanceStation.Camera:2"
        ]
      }
    }
  }
}

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: root
Source: components/stream/worker.py:272
First occurred: 8:46:34 AM (1 occurrences)
Last logged: 8:46:34 AM

Uncaught thread exception
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/srv/homeassistant_2024_7_2/lib/python3.12/site-packages/homeassistant/components/stream/__init__.py", line 438, in _run_worker
    stream_worker(
  File "/srv/homeassistant_2024_7_2/lib/python3.12/site-packages/homeassistant/components/stream/worker.py", line 617, in stream_worker
    muxer.mux_packet(first_keyframe)
  File "/srv/homeassistant_2024_7_2/lib/python3.12/site-packages/homeassistant/components/stream/worker.py", line 272, in mux_packet
    self._av_output.mux(packet)
  File "av/container/output.pyx", line 218, in av.container.output.OutputContainer.mux
  File "av/container/output.pyx", line 224, in av.container.output.OutputContainer.mux_one
  File "av/container/output.pyx", line 190, in av.container.output.OutputContainer.start_encoding
  File "av/container/core.pyx", line 290, in av.container.core.Container.err_check
  File "av/error.pyx", line 336, in av.error.err_check
av.error.ValueError: [Errno 22] Invalid argument: '<none>'; last error log: [mp4] dimensions not set

Additional information

Tested viewing stream on iOS HA App, Firefox on Windows Tested 1 Amcrest and 1 Reolink camera, both record reliably and smoothly to DSM/SS (Doorbell was intentionally offline while the above diagnostics were captured) NAS was just setup with the latest DSM a couple weeks ago I did find a possibly related issue that wasn't solved #46184

home-assistant[bot] commented 1 month ago

Hey there @hacf-fr, @quentame, @mib1185, mind taking a look at this issue as it has been labeled with an integration (synology_dsm) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `synology_dsm` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign synology_dsm` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


synology_dsm documentation synology_dsm source (message by IssueLinks)

mib1185 commented 1 month ago

the stream of your doorbell camera seems to be not compatible with the stream integration - please provide more details about this camera and how exactly did you integrate it into the surveillance station, thx :+1:

charlespick commented 4 weeks ago

@mib1185 the doorbell is not online yet. Could that be causing the problem you are seeing? I can bring it back online and collect logs again if needed.

mib1185 commented 3 weeks ago

I'm a bit confused - as per your provided diagnostics data you've two cameras connected to the Surveillance Station Portercam and Doorbell, while Doorbell is disconnected. How exactly do you start these streams? And which one?

Further please enable debug logging, restart the integration and download and provide the log file after the issue occur again.

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

thx 👍

charlespick commented 2 weeks ago

@mib1185 just ignore the doorbell for now. I had it wired up to a power brick for a moment to configure the wifi but it is having other issues so I haven't mounted it on my house yet.

Would it be possible to share the log privately somewhere? When enabling debug logging the log grows to over 1000 lines in minutes. I can't go through it all to make sure it is free of secrets and there is encoded information that I can't even tell how it's encoded to know if it is a secret.

mib1185 commented 2 weeks ago

Hi @charlespick feel free to contact me on discord (mib1185) 👍

charlespick commented 2 weeks ago

@mib1185 sent you a message

mib1185 commented 5 days ago

It seems to be an incompatibility between the video stream of the camera (Portercam) and the stream integration which is responsible to show the stream in HA. Maybe you can adjust some settings in the SurveillanceStation for this camera, but the synology_dsm integration itself does only pass-through the rtsp url (provided by the SurveillanceStation) to the stream integration - maybe this note in the stream docs can help?