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
74.18k stars 31.15k forks source link

Snapshot timeout on ffmpeg camera #51073

Open slydiman opened 3 years ago

slydiman commented 3 years ago

The problem

Ffmpeg camera cannot take a snapshot because of a timeout without any reason. I'm using shell_command for calling ffmpeg -rtsp_transport tcp -i "$1" -an -frames:v 1 -y "$2" as a workaround for now and it works just fine (less than 1 sec). Note I have configured the encoding of RTSP stream with very small IDR frames interval.

What is version of Home Assistant Core has the issue?

core-2021.5.5

What was the last working version of Home Assistant Core?

It worked at least few months ago.

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

FFmpeg Camera

Link to integration documentation on our website

https://www.home-assistant.io/integrations/camera.ffmpeg/

Example YAML snippet

logger:
  default: info
  logs:
     haffmpeg.tools: debug

camera:
  platform: ffmpeg
  name: cam1
  input: "rtsp://192.168.1.20:554/"

shell_command: 
  snapshot_cam1_call2: "bash -x /config/snapshot.sh 'rtsp://192.168.1.20:554/' /config/www/cams/cam1_call2.jpg > /config/snapshot.log 2>&1"

automation:
- alias: Call1
  trigger:
  - platform: state
    entity_id: sensor.button1_action
    to: 'single'
  action:
# Does not work! 
  - service: camera.snapshot
    target:
      entity_id: camera.cam1
    data:
      filename: "/config/www/cams/cam1_call1.jpg"
  - delay: 00:00:05
  - service: notify.telegram
    data:
      message: ""
      data:
        photo:
        - file: "/config/www/cams/cam1_call1.jpg"
          caption: "Call 1 πŸ“·"

- alias: Call2
  trigger:
  - platform: state
    entity_id: sensor.button2_action
    to: 'single'
  action:
# Works fine!
  - service: shell_command.snapshot_cam1_call2
  - delay: 00:00:05
  - service: notify.telegram
    data:
      message: ""
      data:
        photo:
        - file: "/config/www/cams/cam1_call2.jpg"
          caption: "Call 2 πŸ“·"

Anything in the logs that might be useful for us?

I tried to enable logs for haffmpeg.tools, but the log does not contain any useful information, just a timeout.

Additional information

/config/snapshot.sh:

ffmpeg -rtsp_transport tcp -i "$1" -an -frames:v 1 -y "$2"
github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

slydiman commented 3 years ago

Ping

github-actions[bot] commented 3 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

slydiman commented 3 years ago

Ping

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

slydiman commented 2 years ago

core-2022.2.9 - nothing changed

github-actions[bot] commented 2 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

slydiman commented 2 years ago

Ping

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

slydiman commented 1 year ago

Ping

xppx99 commented 1 year ago

I also have the same problem. In 2021 it used to work... I'll try to adapt the workaround provided by slydiman

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

slydiman commented 1 year ago

Ping

issue-triage-workflows[bot] commented 1 year ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

slydiman commented 1 year ago

Ping

jmighion commented 1 year ago

I ran into something similar. I had a shell command that takes around 2 minutes stop working on me. I found the shell command now has a hardcoded 60 second timeout. See this other related issue : https://github.com/home-assistant/core/issues/45393# Does your script take longer than 60 seconds?

slydiman commented 1 year ago

Does your script take longer than 60 seconds?

No, 2-3 seconds. It depends on the key (IDR) frame interval. Usually it can be configured on the camera/DVR.

issue-triage-workflows[bot] commented 10 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

jmighion commented 10 months ago

Still happening

issue-triage-workflows[bot] commented 7 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

jmighion commented 7 months ago

Still an issue

issue-triage-workflows[bot] commented 4 months ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

xppx99 commented 4 months ago

still happens.

issue-triage-workflows[bot] commented 1 month ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment πŸ‘ This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

slydiman commented 1 month ago

ping

slydiman commented 3 weeks ago

I recommend to use the go2rtc integration and this solution https://github.com/AlexxIT/go2rtc/wiki/Snapshot-to-Telegram