Skip to content

NVR with realtime local object detection for IP cameras

set shortest edge to preview height (#11971)

Blake Blackshear15e2df1e5c5d
diff --git a/frigate/output/preview.py b/frigate/output/preview.py
index 1f72a488b1..b47a5c3022 100644
--- a/frigate/output/preview.py
+++ b/frigate/output/preview.py
@@ -152,10 +152,20 @@ class PreviewRecorder:
self.start_time = 0
self.last_output_time = 0
self.output_frames = []
- self.out_height = PREVIEW_HEIGHT
- self.out_width = (
- int((config.detect.width / config.detect.height) * self.out_height) // 4 * 4
- )
+ if config.detect.width > config.detect.height:
+ self.out_height = PREVIEW_HEIGHT
+ self.out_width = (
+ int((config.detect.width / config.detect.height) * self.out_height)
+ // 4
+ * 4
+ )
+ else:
+ self.out_width = PREVIEW_HEIGHT
+ self.out_height = (
+ int((config.detect.height / config.detect.width) * self.out_width)
+ // 4
+ * 4
+ )
# create communication for finished previews
self.requestor = InterProcessRequestor()