NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Fix shared memory frames being stuck when a camera capture crashed (#14140)
Nicolas Mowene72573098241
diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.shindex 2c52cf552d..7c2c5fda2e 100755--- a/docker/main/install_deps.sh+++ b/docker/main/install_deps.sh@@ -44,7 +44,7 @@ if [[ "${TARGETARCH}" == "amd64" ]]; thenwget -qO btbn-ffmpeg.tar.xz "https://github.com/NickM-27/FFmpeg-Builds/releases/download/autobuild-2022-07-31-12-37/ffmpeg-n5.1-2-g915ef932a3-linux64-gpl-5.1.tar.xz"tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/ffmpeg/5.0 --strip-components 1rm -rf btbn-ffmpeg.tar.xz /usr/lib/ffmpeg/5.0/doc /usr/lib/ffmpeg/5.0/bin/ffplay- wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-19-12-51/ffmpeg-n7.0.2-18-g3e6cec1286-linux64-gpl-7.0.tar.xz"+ wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-30-15-36/ffmpeg-n7.1-linux64-gpl-7.1.tar.xz"tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/ffmpeg/7.0 --strip-components 1rm -rf btbn-ffmpeg.tar.xz /usr/lib/ffmpeg/7.0/doc /usr/lib/ffmpeg/7.0/bin/ffplayfi@@ -56,7 +56,7 @@ if [[ "${TARGETARCH}" == "arm64" ]]; thenwget -qO btbn-ffmpeg.tar.xz "https://github.com/NickM-27/FFmpeg-Builds/releases/download/autobuild-2022-07-31-12-37/ffmpeg-n5.1-2-g915ef932a3-linuxarm64-gpl-5.1.tar.xz"tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/ffmpeg/5.0 --strip-components 1rm -rf btbn-ffmpeg.tar.xz /usr/lib/ffmpeg/5.0/doc /usr/lib/ffmpeg/5.0/bin/ffplay- wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-19-12-51/ffmpeg-n7.0.2-18-g3e6cec1286-linuxarm64-gpl-7.0.tar.xz"+ wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2024-09-30-15-36/ffmpeg-n7.1-linuxarm64-gpl-7.1.tar.xz"tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/ffmpeg/7.0 --strip-components 1rm -rf btbn-ffmpeg.tar.xz /usr/lib/ffmpeg/7.0/doc /usr/lib/ffmpeg/7.0/bin/ffplayfidiff --git a/frigate/video.py b/frigate/video.pyindex a8514ae036..0f051b6b26 100755--- a/frigate/video.py+++ b/frigate/video.py@@ -94,6 +94,7 @@ def capture_frames(ffmpeg_process,config: CameraConfig,shm_frame_count: int,+ shm_frames: list[str],frame_shape,frame_manager: FrameManager,frame_queue,@@ -108,8 +109,6 @@ def capture_frames(skipped_eps = EventsPerSecond()skipped_eps.start()- shm_frames: list[str] = []-while True:fps.value = frame_rate.eps()skipped_fps.value = skipped_eps.eps()@@ -154,10 +153,6 @@ def capture_frames(# if the queue is full, skip this frameskipped_eps.update()- # clear out frames- for frame in shm_frames:- frame_manager.delete(frame)-class CameraWatchdog(threading.Thread):def __init__(@@ -176,6 +171,7 @@ class CameraWatchdog(threading.Thread):self.camera_name = camera_nameself.config = configself.shm_frame_count = shm_frame_count+ self.shm_frames: list[str] = []self.capture_thread = Noneself.ffmpeg_detect_process = Noneself.logpipe = LogPipe(f"ffmpeg.{self.camera_name}.detect")@@ -308,6 +304,7 @@ class CameraWatchdog(threading.Thread):self.capture_thread = CameraCapture(self.config,self.shm_frame_count,+ self.shm_frames,self.ffmpeg_detect_process,self.frame_shape,self.frame_queue,@@ -348,6 +345,7 @@ class CameraCapture(threading.Thread):self,config: CameraConfig,shm_frame_count: int,+ shm_frames: list[str],ffmpeg_process,frame_shape,frame_queue,@@ -359,6 +357,7 @@ class CameraCapture(threading.Thread):self.name = f"capture:{config.name}"self.config = configself.shm_frame_count = shm_frame_count+ self.shm_frames = shm_framesself.frame_shape = frame_shapeself.frame_queue = frame_queueself.fps = fps@@ -374,6 +373,7 @@ class CameraCapture(threading.Thread):self.ffmpeg_process,self.config,self.shm_frame_count,+ self.shm_frames,self.frame_shape,self.frame_manager,self.frame_queue,