From 32e30853fb4917681c9051e7a84b711d85891136 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Wed, 29 Nov 2023 11:15:25 -0700 Subject: [PATCH] Ensure minimized resolution is compatible with yuv --- frigate/output/preview.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frigate/output/preview.py b/frigate/output/preview.py index 91d8f45fe..5d5dd7b65 100644 --- a/frigate/output/preview.py +++ b/frigate/output/preview.py @@ -97,7 +97,7 @@ class FFMpegConverter(threading.Thread): end = self.frame_times[-1] if p.returncode == 0: - logger.info("successfully saved preview") + logger.debug("successfully saved preview") self.inter_process_queue.put_nowait( ( INSERT_PREVIEW, @@ -128,8 +128,8 @@ class PreviewRecorder: self.last_output_time = 0 self.output_frames = [] self.out_height = 160 - self.out_width = int( - (config.detect.width / config.detect.height) * self.out_height + self.out_width = ( + int((config.detect.width / config.detect.height) * self.out_height) // 4 * 4 ) y, u1, u2, v1, v2 = get_yuv_crop( @@ -252,4 +252,7 @@ class PreviewRecorder: self.write_frame_to_cache(frame_time, frame) def stop(self) -> None: - shutil.rmtree(os.path.join(CACHE_DIR, FOLDER_PREVIEW_FRAMES)) + try: + shutil.rmtree(os.path.join(CACHE_DIR, FOLDER_PREVIEW_FRAMES)) + except FileNotFoundError: + pass