From e3fa70189324e5eb3b1dba756c153f6696f457de Mon Sep 17 00:00:00 2001 From: teajaysee Date: Thu, 23 Jul 2026 12:12:18 +0100 Subject: [PATCH] Recreate preview output directory before writing (fix 0.18 regression: silent permanent preview loss) (#23784) * Recreate preview output directory before writing it The preview directory is created once in PreviewRecorder.__init__, but record cleanup's remove_empty_directories() can delete it again while it is empty (e.g. a camera re-added after removal, or an hour with no retained previews). FFMpegConverter then fails permanently with "No such file or directory" and previews are silently lost with only one ERROR log line per hour. Recreate the directory before invoking ffmpeg so the hourly export self-heals. Co-Authored-By: Claude Opus 4.8 (1M context) * Remove explanatory comments above the fix Co-Authored-By: Claude Opus 4.8 (1M context) --------- Co-authored-by: Claude Opus 4.8 (1M context) --- frigate/output/preview.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frigate/output/preview.py b/frigate/output/preview.py index cce05565a0..f07521fb8d 100644 --- a/frigate/output/preview.py +++ b/frigate/output/preview.py @@ -159,6 +159,8 @@ class FFMpegConverter(threading.Thread): f"duration {self.frame_times[t_idx + 1] - self.frame_times[t_idx]}" ) + Path(self.path).parent.mkdir(parents=True, exist_ok=True) + try: p = sp.run( self.ffmpeg_cmd.split(" "),