From 9df415b3f2e8833822fda996c5030bc694a524c0 Mon Sep 17 00:00:00 2001 From: uvjustin <46082645+uvjustin@users.noreply.github.com> Date: Fri, 26 Aug 2022 19:32:34 +0800 Subject: [PATCH] Fix VOD issues with longer keyframe intervals (#3671) * Fix VOD issues with longer keyframe intervals * Move probe function to util Update comment * Use recording duration for keyFrameDurations * Remove unused early return * Avoid clipping first clip --- frigate/http.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/frigate/http.py b/frigate/http.py index 84a8c855e..d7c8a729a 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -849,16 +849,13 @@ def vod_ts(camera_name, start_ts, end_ts): for recording in recordings: clip = {"type": "source", "path": recording.path} duration = int(recording.duration * 1000) - # Determine if offset is needed for first clip - if recording.start_time < start_ts: - offset = int((start_ts - recording.start_time) * 1000) - clip["clipFrom"] = offset - duration -= offset + # Determine if we need to end the last clip early if recording.end_time > end_ts: duration -= int((recording.end_time - end_ts) * 1000) if duration > 0: + clip["keyFrameDurations"] = [duration] clips.append(clip) durations.append(duration) else: