-
-
Notifications
You must be signed in to change notification settings - Fork 36.3k
Description
The problem
MP4 recordings from the camera.record service are created with actual lengths that are fairly close to the requested duration+lookback (within a few seconds). However, the video length property is way off. The length property that is saved in the file is improperly listed as just 1-4 seconds long, regardless of the actual length.
The biggest issue here is that (some*) web browsers ignore the full length of the actual video and play only the much shorter listed length, nothing more. Note that other players (VLC, MS MediaPlayer) also show the incorrect short listed length on the playback timeline, but continue on and play the entire video.
*Note: I normally use FireFox where this issue was discovered. Just tried Chrome, and it will playback the entire video. Other players may also have a truncated timeline, but play on. Still - the video length property should match the actual recorded length.
Environment
- Home Assistant Core release with the issue: 108.8
- Last working Home Assistant Core release (if known): before STREAM? Similar to other reported issues with camera.record duration that are still open.
- Operating environment: Home Assistant, RasPi4 2G 32bit
- Integration causing this issue: STREAM & CAMERA
- Link to integration documentation on our website
Problem-relevant configuration.yaml
configuration.yaml
stream:
camera:
- platform: ffmpeg
input: !secret rtsp
name: "Amcrest Doorbell"
automation.yaml
- service: script.video_record
data_template:
entity_id: camera.amcrest_doorbell
filename: '{{ states("input_text.filename") }}'
duration: 5
lookback: 3
scripts.yaml
video_record:
sequence:
- condition: state # continue only if no previous recording already in progress
entity_id: input_boolean.video_recording
state: 'off'
- service: input_boolean.turn_on # turn on recording in progress flag
entity_id: input_boolean.video_recording
- service: camera.record
data_template:
entity_id: '{{ entity_id }}'
filename: '{{ filename }}.mp4'
duration: '{{ duration }}'
lookback: '{{ lookback }}'
Traceback/Error logs
NO errors
Additional information
I ran a series of recording tests with durations from 1 to 10 seconds long, all with a lookback of 3 seconds. As you can see, the expected length was reasonably close to the actual recording length, but the file length recorded in the mp4 file is nothing close to reasonable for the longer recordings.
Shown here is the file properties of the 10+3 second duration MP4 recording. Expected length 13 seconds, actual length 10 seconds, calculated Video Length property - 2 seconds.
