Ich verwende ExiFread (installiert mit Python3 -m PIP Installieren Sie exiFread ), um EXIF -Tags aus Fotos zu lesen. Die gleiche Kamera nimmt Videos mit Erweiterung .Mov und ein Datum erstellen exif ein, das ich mit exiftool anzeigen kann grep Date
File Modification Date/Time : 2020:02:20 18:13:14+00:00
File Access Date/Time : 2020:03:07 08:11:57+00:00
File Inode Change Date/Time : 2020:03:04 11:24:51+00:00
Modify Date : 2020:02:20 18:13:21
Track Create Date : 2020:02:20 18:13:21
Track Modify Date : 2020:02:20 18:13:21
Media Create Date : 2020:02:20 18:13:21
Media Modify Date : 2020:02:20 18:13:21
Create Date : 2020:02:20 18:13:15
Datum /Uhrzeit Original: 2020: 02: 20 18:13:15
Datumsanzeigeformat: y /m /d
< /pre>
Ich nehme an, ich nehme an. PrettyPrint-Override ">import exifread
f = open("/path/to/file", "rb")
tags = exifread.process_file(f)
print(tags)
< /code>
Eine Lösung besteht darin, einen Subprozess-Aufruf an Exiftool < /code> zu tätigen und das Ergebnis analysieren zu können: < /p>
EXIFTOOL_DATE_TAG_VIDEOS = "Create Date"
EXIF_DATE_FORMAT = "%Y:%m:%d %H:%M:%S"
cmd = "exiftool '%s'" % filepath
output = subprocess.check_output(cmd, shell=True)
lines = output.decode("ascii").split("\n")
for l in lines:
if EXIFTOOL_DATE_TAG_VIDEOS in l:
datetime_str = l.split(" : ")[1]
print(datetime.datetime.strptime(datetime_str,
EXIF_DATE_FORMAT))
< /code>
Wie kann ich auf die Liste der EXIF -Tags ohne Subprozess -Aufruf zugreifen? < /p>
Wie lese ich EXIF -Daten von Filmen in Python? ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post