diff --git a/bin/gopro-dashboard.py b/bin/gopro-dashboard.py index ba21bad..7e0b2bf 100644 --- a/bin/gopro-dashboard.py +++ b/bin/gopro-dashboard.py @@ -318,7 +318,8 @@ def fmtdt(dt: datetime.datetime): output=output, options=ffmpeg_options, overlay_size=dimensions, - execution=execution + execution=execution, + creation_time=frame_meta.date_at(frame_meta.min) ) else: output.unlink(missing_ok=True) @@ -328,7 +329,8 @@ def fmtdt(dt: datetime.datetime): output=output, options=ffmpeg_options, overlay_size=dimensions, - execution=execution + execution=execution, + creation_time=frame_meta.date_at(frame_meta.min) ) draw_timer = PoorTimer("drawing frames") diff --git a/gopro_overlay/ffmpeg_overlay.py b/gopro_overlay/ffmpeg_overlay.py index 3dd8874..7dfd96c 100644 --- a/gopro_overlay/ffmpeg_overlay.py +++ b/gopro_overlay/ffmpeg_overlay.py @@ -1,6 +1,7 @@ from __future__ import annotations import contextlib +import datetime from pathlib import Path from gopro_overlay.dimensions import Dimension @@ -42,11 +43,13 @@ def __init__( output: Path, overlay_size: Dimension, options: FFMPEGOptions = None, - execution=None + execution=None, + creation_time: datetime.datetime = None ): self.exe = ffmpeg self.output = output self.overlay_size = overlay_size + self.creation_time = creation_time if creation_time else datetime.datetime.now() self.execution = execution if execution else InProcessExecution() self.options = options if options else FFMPEGOptions() @@ -63,6 +66,7 @@ def generate(self): "-i", "-", "-r", "30", self.options.output, + "-metadata", f"creation_time={self.creation_time.isoformat()}", str(self.output) ]) @@ -78,13 +82,15 @@ def __init__( output: Path, overlay_size: Dimension, options: FFMPEGOptions = None, - execution=None + execution=None, + creation_time: datetime.datetime = None ): self.exe = ffmpeg self.output = output self.input = input self.options = options if options else FFMPEGOptions() self.overlay_size = overlay_size + self.creation_time = creation_time if creation_time else datetime.datetime.now() self.execution = execution if execution else InProcessExecution() @contextlib.contextmanager @@ -101,6 +107,7 @@ def generate(self): "-i", "-", "-filter_complex", self.options.filter_complex, self.options.output, + "-metadata", f"creation_time={self.creation_time.isoformat()}", str(self.output) ])