diff --git a/frigate/review/maintainer.py b/frigate/review/maintainer.py index 59a329b22..1ffdfa9e2 100644 --- a/frigate/review/maintainer.py +++ b/frigate/review/maintainer.py @@ -81,6 +81,11 @@ class PendingReviewSegment: region = calculate_16_9_crop( camera_config.frame_shape, min_x, min_y, max_x, max_y ) + + # could not find suitable 16:9 region + if not region: + return + color_frame = cv2.cvtColor(frame, cv2.COLOR_YUV2BGR_I420) color_frame = color_frame[region[1] : region[3], region[0] : region[2]] width = int(THUMB_HEIGHT * color_frame.shape[1] / color_frame.shape[0]) diff --git a/frigate/util/image.py b/frigate/util/image.py index 21685a182..0afa451b7 100644 --- a/frigate/util/image.py +++ b/frigate/util/image.py @@ -231,6 +231,9 @@ def calculate_16_9_crop(frame_shape, xmin, ymin, xmax, ymax, multiplier=1.25): # if 16:9 by height is too small if aspect_y_size < y_size or aspect_y_size > frame_shape[0]: x_size = int((16 / 9) * y_size) // 4 * 4 + + if x_size / y_size > 1.8: + return None else: y_size = aspect_y_size // 4 * 4