I have a camera:
camera:
- platform: ffmpeg
name: security_camera
input: -rtsp_transport tcp -i rtsp://securitypi.local:8554/unicast
extra_arguments: >-
-vf "hue=s=0, drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:text='%{localtime\:%Y-%m-%d %T}':[email protected]:x=10:y=10"
I’ve added the drawtext
filter recently (in extra_arguments
). What stumps me is that snapshops (and the live still view) contain the overlay, but the recordings (and live stream) don’t. The only thing I can imagine is that the snapshot and record services follow different code paths or that there is a bug in the underlying haffmpeg
library. I’ve been reading the code to understand this better, but my current knowledge falls short in order to put all the pieces together. I can see the extra_arguments
is supported by the haffmpeg
library. What am I missing that this isn’t working as expected?
These are my scripts:
security_camera_record_clip:
mode: queued
sequence:
- service: camera.record
data:
entity_id: camera.security_camera
filename: '/tmp/camera.security_camera_{{ now().strftime("%Y%m%d-%H%M%S") }}.mp4'
duration: 10
- delay: "00:00:15"
- service: shell_command.copy_last_video_clip
- service: input_datetime.set_datetime
entity_id: input_datetime.security_camera_last_clip
data:
datetime: "{{ now() }}"
security_camera_create_snapshot:
mode: queued
sequence:
- service: camera.snapshot
data:
entity_id: camera.security_camera
filename: '/tmp/camera.security_camera_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg'
- service: input_datetime.set_datetime
entity_id: input_datetime.security_camera_last_snapshot
data:
datetime: "{{ now() }}"
- service: shell_command.copy_last_snapshot_image
- condition: state
entity_id: group.security_automations
state: "on"
- service: notify.family
data:
title: Security Camera
message: "Motion detected!"
data:
group: "security-camera-snapshots"
attachment:
url: !secret security_camera_last_snapshot_url
A second observation is that the ffmpeg camera state is never anything but idle (even when recording). It seems like the ffmpeg
platform never sets the state in code (not explicitly). If this gets supported, I can get rid of the delay I’m using above.