From c716e4b1cb953b99a12ab02fe265280545dbc1c5 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 4 Dec 2023 06:05:55 -0700 Subject: [PATCH] Ensure final frame in preview is not duplicated --- frigate/output/preview.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frigate/output/preview.py b/frigate/output/preview.py index 3346274d4..784051f47 100644 --- a/frigate/output/preview.py +++ b/frigate/output/preview.py @@ -229,10 +229,6 @@ class PreviewRecorder: self.write_frame_to_cache(frame_time, frame) return - if self.should_write_frame(current_tracked_objects, motion_boxes, frame_time): - self.output_frames.append(frame_time) - self.write_frame_to_cache(frame_time, frame) - # check if PREVIEW clip should be generated and cached frames reset if frame_time >= self.segment_end: # save last frame to ensure consistent duration @@ -257,6 +253,9 @@ class PreviewRecorder: # include first frame to ensure consistent duration self.output_frames.append(frame_time) self.write_frame_to_cache(frame_time, frame) + elif self.should_write_frame(current_tracked_objects, motion_boxes, frame_time): + self.output_frames.append(frame_time) + self.write_frame_to_cache(frame_time, frame) def stop(self) -> None: try: