NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
actually keep track of skipped frames (#6889)
Cody Cutreree4a1336558e
diff --git a/frigate/video.py b/frigate/video.pyindex f60bce1d9a..4f315885ca 100755--- a/frigate/video.py+++ b/frigate/video.py@@ -172,7 +172,7 @@ def capture_frames(skipped_eps.start()while True:fps.value = frame_rate.eps()- skipped_eps.eps()+ skipped_fps.value = skipped_eps.eps()current_frame.value = datetime.datetime.now().timestamp()frame_name = f"{camera_name}{current_frame.value}"@@ -215,6 +215,7 @@ class CameraWatchdog(threading.Thread):config: CameraConfig,frame_queue,camera_fps,+ skipped_fps,ffmpeg_pid,stop_event,):@@ -227,6 +228,7 @@ class CameraWatchdog(threading.Thread):self.logpipe = LogPipe(f"ffmpeg.{self.camera_name}.detect")self.ffmpeg_other_processes: list[dict[str, any]] = []self.camera_fps = camera_fps+ self.skipped_fps = skipped_fpsself.ffmpeg_pid = ffmpeg_pidself.frame_queue = frame_queueself.frame_shape = self.config.frame_shape_yuv@@ -346,6 +348,7 @@ class CameraWatchdog(threading.Thread):self.frame_shape,self.frame_queue,self.camera_fps,+ self.skipped_fps,self.stop_event,)self.capture_thread.start()@@ -376,7 +379,14 @@ class CameraWatchdog(threading.Thread):class CameraCapture(threading.Thread):def __init__(- self, camera_name, ffmpeg_process, frame_shape, frame_queue, fps, stop_event+ self,+ camera_name,+ ffmpeg_process,+ frame_shape,+ frame_queue,+ fps,+ skipped_fps,+ stop_event,):threading.Thread.__init__(self)self.name = f"capture:{camera_name}"@@ -385,14 +395,13 @@ class CameraCapture(threading.Thread):self.frame_queue = frame_queueself.fps = fpsself.stop_event = stop_event- self.skipped_fps = EventsPerSecond()+ self.skipped_fps = skipped_fpsself.frame_manager = SharedMemoryFrameManager()self.ffmpeg_process = ffmpeg_processself.current_frame = mp.Value("d", 0.0)self.last_frame = 0def run(self):- self.skipped_fps.start()capture_frames(self.ffmpeg_process,self.camera_name,@@ -424,6 +433,7 @@ def capture_camera(name, config: CameraConfig, process_info):config,frame_queue,process_info["camera_fps"],+ process_info["skipped_fps"],process_info["ffmpeg_pid"],stop_event,)