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: