From b6db97d313602159a918d9f54695bce8c75217b3 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 18 Feb 2025 08:48:03 -0600 Subject: [PATCH] Add metadata title field to exports (#16664) --- frigate/record/export.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frigate/record/export.py b/frigate/record/export.py index 48fe20e83..f05fae6aa 100644 --- a/frigate/record/export.py +++ b/frigate/record/export.py @@ -80,8 +80,8 @@ class RecordingExporter(threading.Thread): Path(os.path.join(CLIPS_DIR, "export")).mkdir(exist_ok=True) def get_datetime_from_timestamp(self, timestamp: int) -> str: - """Convenience fun to get a simple date time from timestamp.""" - return datetime.datetime.fromtimestamp(timestamp).strftime("%Y/%m/%d %H:%M") + # return in iso format + return datetime.datetime.fromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S") def save_thumbnail(self, id: str) -> str: thumb_path = os.path.join(CLIPS_DIR, f"export/{id}.webp") @@ -236,6 +236,10 @@ class RecordingExporter(threading.Thread): if self.config.ffmpeg.apple_compatibility: ffmpeg_cmd += FFMPEG_HVC1_ARGS + # add metadata + title = f"Frigate Recording for {self.camera}, {self.get_datetime_from_timestamp(self.start_time)} - {self.get_datetime_from_timestamp(self.end_time)}" + ffmpeg_cmd.extend(["-metadata", f"title={title}"]) + ffmpeg_cmd.append(video_path) return ffmpeg_cmd, playlist_lines @@ -323,6 +327,10 @@ class RecordingExporter(threading.Thread): ) ).split(" ") + # add metadata + title = f"Frigate Preview for {self.camera}, {self.get_datetime_from_timestamp(self.start_time)} - {self.get_datetime_from_timestamp(self.end_time)}" + ffmpeg_cmd.extend(["-metadata", f"title={title}"]) + return ffmpeg_cmd, playlist_lines def run(self) -> None: