Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshot timeout on ffmpeg camera #51073

Open
slydiman opened this issue May 25, 2021 · 27 comments
Open

Snapshot timeout on ffmpeg camera #51073

slydiman opened this issue May 25, 2021 · 27 comments

Comments

@slydiman
Copy link
Contributor

slydiman commented May 25, 2021

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 -update 1 -f image2 -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 -update 1 -f image2 -y "$2"
@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Aug 23, 2021
@slydiman
Copy link
Contributor Author

Ping

@github-actions github-actions bot removed the stale label Aug 23, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Nov 21, 2021
@slydiman
Copy link
Contributor Author

Ping

@github-actions github-actions bot removed the stale label Nov 22, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot added the stale label Feb 20, 2022
@slydiman
Copy link
Contributor Author

core-2022.2.9 - nothing changed

@github-actions github-actions bot removed the stale label Feb 21, 2022
@github-actions
Copy link

github-actions bot commented Jul 6, 2022

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.

@github-actions github-actions bot added the stale label Jul 6, 2022
@slydiman
Copy link
Contributor Author

slydiman commented Jul 6, 2022

Ping

@github-actions github-actions bot removed the stale label Jul 6, 2022
@issue-triage-workflows
Copy link

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
Copy link
Contributor Author

Ping

@xppx99
Copy link

xppx99 commented Feb 12, 2023

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
Copy link

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
Copy link
Contributor Author

Ping

@issue-triage-workflows
Copy link

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
Copy link
Contributor Author

Ping

@jmighion
Copy link

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 : #45393
Does your script take longer than 60 seconds?

@slydiman
Copy link
Contributor Author

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
Copy link

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
Copy link

Still happening

@issue-triage-workflows
Copy link

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
Copy link

Still an issue

@issue-triage-workflows
Copy link

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
Copy link

xppx99 commented Jul 22, 2024

still happens.

@issue-triage-workflows
Copy link

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
Copy link
Contributor Author

ping

@slydiman
Copy link
Contributor Author

slydiman commented Nov 6, 2024

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

@slydiman
Copy link
Contributor Author

I have updated the ffmpeg command to work with latest ffmpeg 2024+:
ffmpeg -rtsp_transport tcp -i "$1" -an -frames:v 1 -update 1 -f image2 -y "$2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants