corrected GoPro mp4 with exiftool

This commit is contained in:
Andreas Balogh
2023-08-28 21:19:13 +02:00
parent 0e4999b6f3
commit 5df836529b
4 changed files with 98 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ from pathlib import Path
import datetime as dt
import re
import os
import subprocess
DRY_RUN = False
@@ -22,10 +23,10 @@ def rename(old, new):
print(f"skipped {old.name}, {new.name}, already exists")
# src = Path(r'D:\Videos')
src = Path(r"D:\MediaLibrary\Pictures\2022\20220831 Urlaub Cote d'Azur")
src = Path(r"D:\MediaLibrary\Pictures\2023\20230819 Urlaub Nordkapp")
for raw in src.glob("*pano.jpg"):
mo = re.match("(?P<author>[^-]*)-(?P<dt>\S*)-(?P<model>[^-]*)(-\S+)?.jpg", raw.name)
for raw in src.glob("*.mp4"):
mo = re.match("(?P<author>[^-]*)-(?P<dt>\S{8}-\S{6})-(?P<model>[^-]*)(-\S+)?.mp4", raw.name)
if mo is None:
print(f"skipped {raw.name}, no match")
continue
@@ -34,7 +35,12 @@ for raw in src.glob("*pano.jpg"):
mtime = rawdt.timestamp()
atime = raw.stat().st_atime
print(f"setting {raw.name} to {rawdt}")
exifdt = (rawdt+dt.timedelta(hours=2)).strftime('%Y:%m:%d %H:%M:%S')
print(f'exiftool "-AllDates={exifdt}" "{raw}"')
subprocess.run(["exiftool", f"-AllDates={exifdt}", f"{raw}"])
if not DRY_RUN:
os.utime(raw, (atime, mtime))
# fn = f"{md['author'].lower()}-{md['dt']}-{md['model']}{raw.suffix}"
# rename(raw, raw.parent / fn)
# use exiftool for MP4 metadata timestamps 3127 days, 19:36:35
# exiftool "-AllDates+=3127 19:36:35" "E:\RawTriage\GoPro Hero\20230819"