Add object detection, tracking, mobile notifications, and search to any security camera.
add back track segments
roryclearcd33ea2d2e65
diff --git a/clearcam.py b/clearcam.pyindex bbaeba1..2e3bf30 100644--- a/clearcam.py+++ b/clearcam.py@@ -753,6 +753,7 @@ class HLSStreamer:self.ffmpeg_proc = subprocess.Popen(ffmpeg_cmd, stdin=subprocess.PIPE)threading.Thread(target=self._feed_frames, daemon=True).start()+ threading.Thread(target=self._track_segments, daemon=True).start()def export_last_segments(self,output_path: Path,last=False):@@ -802,6 +803,13 @@ class HLSStreamer:except subprocess.CalledProcessError as e:print(f"Failed to save video: {e}")+ def _track_segments(self):+ while self.running:+ segment_files = sorted(self.current_stream_dir.glob("*.ts"), key=os.path.getmtime)+ self.recent_segments.clear()+ self.recent_segments.extend(segment_files[-4:]) # last 3 for now+ time.sleep(self.segment_time / 2)+def _feed_frames(self):last_frame_time = time.time()stall_timeout = 10