NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Add metadata for creation time to recording segments and exports (#23239)
Nicolas Mowen26d31300e66d
diff --git a/frigate/record/export.py b/frigate/record/export.pyindex d4b49bb4b0..3c4f3ba4a5 100644--- a/frigate/record/export.py+++ b/frigate/record/export.py@@ -235,7 +235,17 @@ class RecordingExporter(threading.Thread):# add metadatatitle = 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}"])+ creation_time = datetime.datetime.fromtimestamp(+ self.start_time, tz=datetime.timezone.utc+ ).strftime("%Y-%m-%dT%H:%M:%S.%fZ")+ ffmpeg_cmd.extend(+ [+ "-metadata",+ f"title={title}",+ "-metadata",+ f"creation_time={creation_time}",+ ]+ )ffmpeg_cmd.append(video_path)@@ -326,7 +336,17 @@ class RecordingExporter(threading.Thread):# add metadatatitle = 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}"])+ creation_time = datetime.datetime.fromtimestamp(+ self.start_time, tz=datetime.timezone.utc+ ).strftime("%Y-%m-%dT%H:%M:%S.%fZ")+ ffmpeg_cmd.extend(+ [+ "-metadata",+ f"title={title}",+ "-metadata",+ f"creation_time={creation_time}",+ ]+ )return ffmpeg_cmd, playlist_linesdiff --git a/frigate/record/maintainer.py b/frigate/record/maintainer.pyindex a90d1edc12..e36df78d0b 100644--- a/frigate/record/maintainer.py+++ b/frigate/record/maintainer.py@@ -547,6 +547,8 @@ class RecordingMaintainer(threading.Thread):"copy","-movflags","+faststart",+ "-metadata",+ f"creation_time={start_time.strftime('%Y-%m-%dT%H:%M:%S.%fZ')}",file_path,stderr=asyncio.subprocess.PIPE,stdout=asyncio.subprocess.DEVNULL,