diff --git a/frigate/output/output.py b/frigate/output/output.py index 7d5b6d39a..1859ebd69 100644 --- a/frigate/output/output.py +++ b/frigate/output/output.py @@ -63,6 +63,7 @@ def output_frames( birdseye: Optional[Birdseye] = None preview_recorders: dict[str, PreviewRecorder] = {} preview_write_times: dict[str, float] = {} + failed_frame_requests: dict[str, int] = {} move_preview_frames("cache") @@ -99,7 +100,16 @@ def output_frames( if frame is None: logger.debug(f"Failed to get frame {frame_id} from SHM") + failed_frame_requests[camera] = failed_frame_requests.get(camera, 0) + 1 + + if failed_frame_requests[camera] > config.cameras[camera].detect.fps: + logger.warning( + f"Failed to retrieve many frames for {camera} from SHM, consider increasing SHM size if this continues." + ) + continue + else: + failed_frame_requests[camera] = 0 # send camera frame to ffmpeg process if websockets are connected if any( diff --git a/frigate/output/preview.py b/frigate/output/preview.py index a8915f688..9eae6b7de 100644 --- a/frigate/output/preview.py +++ b/frigate/output/preview.py @@ -154,6 +154,7 @@ class PreviewRecorder: self.start_time = 0 self.last_output_time = 0 self.output_frames = [] + if config.detect.width > config.detect.height: self.out_height = PREVIEW_HEIGHT self.out_width = ( @@ -274,7 +275,7 @@ class PreviewRecorder: return False - def write_frame_to_cache(self, frame_time: float, frame) -> None: + def write_frame_to_cache(self, frame_time: float, frame: np.ndarray) -> None: # resize yuv frame small_frame = np.zeros((self.out_height * 3 // 2, self.out_width), np.uint8) copy_yuv_to_position( @@ -303,7 +304,7 @@ class PreviewRecorder: current_tracked_objects: list[dict[str, any]], motion_boxes: list[list[int]], frame_time: float, - frame, + frame: np.ndarray, ) -> bool: # check for updated record config _, updated_record_config = self.config_subscriber.check_for_update() @@ -332,6 +333,10 @@ class PreviewRecorder: self.output_frames, self.requestor, ).start() + else: + logger.debug( + f"Not saving preview for {self.config.name} because there are no saved frames." + ) # reset frame cache self.segment_end = (