diff --git a/core/streaming/readers.py b/core/streaming/readers.py index 32a424a..78a3d45 100644 --- a/core/streaming/readers.py +++ b/core/streaming/readers.py @@ -94,8 +94,17 @@ class RTSPReader: if not ret or frame is None: consecutive_errors += 1 + # Verbose logging to see actual errors + logger.error(f"Camera {self.camera_id}: cap.read() failed - ret={ret}, frame={frame is not None}") + + # Try to get more info from the capture + if self.cap.isOpened(): + logger.debug(f"Camera {self.camera_id}: Capture still open, backend: {self.cap.getBackendName()}") + else: + logger.error(f"Camera {self.camera_id}: Capture is closed!") + if consecutive_errors >= self.max_consecutive_errors: - logger.error(f"Camera {self.camera_id}: Too many consecutive errors, reinitializing") + logger.error(f"Camera {self.camera_id}: Too many consecutive errors ({consecutive_errors}), reinitializing") self._reinitialize_capture() consecutive_errors = 0 time.sleep(self.error_recovery_delay)