core: Snapshot timeout on ffmpeg camera

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"

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 3
  • Comments: 19 (8 by maintainers)

Most upvoted comments

Ping

Ping

Ping