Skip to content

Commit

Permalink
set shortest edge to preview height (#11971)
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Jun 15, 2024
1 parent 0d862d6 commit 15e2df1
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions frigate/output/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,20 @@ def __init__(self, config: CameraConfig) -> None:
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()
Expand Down

0 comments on commit 15e2df1

Please sign in to comment.