简体   繁体   English

Apple Live 照片元数据

[英]Apple Live Photos Metadata

When I export a live photo from the photos app on my mac, it creates two separate files: a jpg and a mov.当我从 Mac 上的照片应用程序导出实时照片时,它会创建两个单独的文件:jpg 和 mov。 The jpg comes with all its exif data, while the mov file seems always off by five hours. jpg 带有所有的 exif 数据,而 mov 文件似乎总是在五个小时内关闭。

More concretely, I used exiftool -option filename.更具体地说,我使用了 exiftool -option 文件名。 These were the results for the jpg (the yyyy-mm-dd was the same for all, so I'm just including the time output).这些是 jpg 的结果(所有的 yyyy-mm-dd 都是一样的,所以我只包括时间输出)。

DateTimeOriginal 10:24:38
GPSDateTime 15:24:38Z
MediaCreateDate none
FileModifyDate 15:47:46-05:00
ModifyDate 10:24:38

These were the results for the mov.这些是 mov 的结果。

DateTimeOriginal none
GPSDateTime none
MediaCreateDate 15:24:38
FileModifyDate 15:47:29-05:00
ModifyDate 15:24:40

The time it should display is DateTimeOriginal of the jpg.它应该显示的时间是 jpg 的 DateTimeOriginal。 It looks like MediaCreateDate of the mov is off by five hours, due to perhaps a timezone-related glitch.由于可能与时区相关的故障,mov 的 MediaCreateDate 似乎关闭了五个小时。

Anyway, the reason I'm asking the question is that I want to transition from using Apple photos to a plain folder tree in dropbox.无论如何,我问这个问题的原因是我想从使用 Apple 照片过渡到 Dropbox 中的普通文件夹树。 The problem is having a good naming scheme to keep things sorted.问题是有一个很好的命名方案来保持排序。 I googled a bit and using Hazel (plus the script below) works just fine, if it weren't for the mov files of live photos.我用谷歌搜索了一下,如果不是实时照片的 mov 文件,使用 Hazel(加上下面的脚本)工作得很好。 to sort all my photos (and live photos) with a decent naming scheme.使用合适的命名方案对我所有的照片(和实时照片)进行排序。

How can I tweak the script below to get the correct name for the mov files?如何调整下面的脚本以获得 mov 文件的正确名称?

Or, alternatively或者,或者

How can I use Hazel to tell each mov file to have the DateTimeOriginal of the jpg with the same name?如何使用 Hazel 告诉每个 mov 文件具有相同名称的 jpg 的 DateTimeOriginal?

By this last thing I mean having a script which if fed a mov file looks for a jpg of the same name and uses its DateTimeOriginal.最后一件事我的意思是有一个脚本,如果输入 mov 文件,它会查找同名的 jpg 并使用其 DateTimeOriginal。

By the way, the second answer here ( Apple Live Photo file format ) seems to explain how Photos keeps track of the metadata for the mov file, but I have no idea how to use it.顺便说一下,这里的第二个答案( Apple Live Photo 文件格式)似乎解释了照片如何跟踪 mov 文件的元数据,但我不知道如何使用它。

I actually found two scripts.我实际上找到了两个脚本。 The first here ( https://www.macstories.net/reviews/better-dropbox-camera-uploads-with-camerasync/ ).第一个在这里( https://www.macstories.net/reviews/better-dropbox-camera-uploads-with-camerasync/ )。

<?php
date_default_timezone_set("Europe/Rome");
$date = exif_read_data($argv[1],"EXIF");
$date = $date["DateTimeOriginal"];
$time = date_parse_from_format("Y:m:d H:i:s",$date);
$time = mktime($time["hour"],$time["minute"],$time["second"],$time["month"],$time["day"],$time["year"]);
touch($argv[1],$time,$time);
?>

The second ( https://www.noodlesoft.com/forums/viewtopic.php?f=4&t=2218 ) is第二个( https://www.noodlesoft.com/forums/viewtopic.php?f=4&t=2218 )是

exiftool -P -d '%Y.%m.%d at %H.%M.%S' \
   '-filename<${FileModifyDate;}.%e' \
    '-filename<${GPSDateTime;}.%e' \
    '-filename<${MediaCreateDate;}.%e' \
    '-filename<${ModifyDate;}.%e' \
    '-filename<${DateTimeOriginal;}.%e' \
    "$1"

I previously asked this on apple.stackexchange but got no attention.我之前在 apple.stackexchange 上问过这个问题,但没有得到关注。 https://apple.stackexchange.com/questions/236377/live-photos-metadata https://apple.stackexchange.com/questions/236377/live-photos-metadata

Also weighing in on this old question:还权衡这个老问题:

When working with live photos as separated JPG and MOV files, the metadata will allow you to link the files.将实时照片作为分离的 JPG 和 MOV 文件处理时,元数据将允许您链接文件。 The MOV file has an EXIF tag called ContentIdentifier that appears to be identical to the tag Apple_0x0011 in the MakerNotes EXIF tag of the JPG file. MOV 文件有一个名为 ContentIdentifier 的 EXIF 标签,它看起来与 JPG 文件的 MakerNotes EXIF 标签中的标签 Apple_0x0011 相同。

Using exiftool:使用exiftool:

$ exiftool -u -s IMG_8403.JPG | grep Apple_0x0011 Apple_0x0011 : C09DCB26-D321-4254-9F68-2E2E7FA16155 $ exiftool -ContentIdentifier IMG_8403.MOV Content Identifier : C09DCB26-D321-4254-9F68-2E2E7FA16155

Here's a strategy: subtract 5 hours from the modify times of all the .mov files, then proceed as normal:这是一个策略:从所有 .mov 文件的修改时间中减去 5 小时,然后照常进行:

cd folder-with-your-stuff
find * -name "*.mov" |
  while read filepath; do
    olddate=$(date -R -r "$filepath")
    touch -d "$olddate - 5 hours" "$filepath"
  done

Ref: https://askubuntu.com/questions/62492/how-can-i-change-the-date-modified-created-of-a-file参考: https : //askubuntu.com/questions/62492/how-can-i-change-the-date-modified-created-of-a-file

Quite old at this point, but thought I'd weigh in.在这一点上已经很老了,但我想我会权衡一下。

GPSDateTime is always in the UTC timezone (hence the Z appended to the date). GPSDateTime总是在UTC时区(因此Z附加到日期)。 So, it appears that MediaCreateDate is being set to the UTC time, with the zone stripped off.因此,似乎MediaCreateDate被设置为UTC时间,区域被剥离。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM