Skip to content

NVR with realtime local object detection for IP cameras

Ensure thumb camera directory exists before saving (#17339)

Nicolas Mowenc239721021ae
diff --git a/frigate/camera/state.py b/frigate/camera/state.py
index 0495be1fc4..98f808bf66 100644
--- a/frigate/camera/state.py
+++ b/frigate/camera/state.py
@@ -461,9 +461,9 @@ class CameraState:
# create thumbnail with max height of 175 and save
width = int(175 * img_frame.shape[1] / img_frame.shape[0])
thumb = cv2.resize(img_frame, dsize=(width, 175), interpolation=cv2.INTER_AREA)
- cv2.imwrite(
- os.path.join(THUMB_DIR, self.camera_config.name, f"{event_id}.webp"), thumb
- )
+ thumb_path = os.path.join(THUMB_DIR, self.camera_config.name)
+ os.makedirs(thumb_path, exist_ok=True)
+ cv2.imwrite(os.path.join(thumb_path, f"{event_id}.webp"), thumb)
def shutdown(self) -> None:
for obj in self.tracked_objects.values():