2

When I export a live photo from the photos app on my mac, it creates two separate files: a jpg and a mov. The jpg comes with all its exif data, while the mov file seems always off by five hours.

More concretely, I used exiftool -option filename. These were the results for the jpg (the yyyy-mm-dd was the same for all, so I'm just including the time output).

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.

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. It looks like MediaCreateDate of the mov is off by five hours, due to perhaps a timezone-related glitch.

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. 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. 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?

Or, alternatively

How can I use Hazel to tell each mov file to have the DateTimeOriginal of the jpg with the same name?

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.

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.

I actually found two scripts. The first here (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

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. https://apple.stackexchange.com/questions/236377/live-photos-metadata

Community
  • 1
  • 1
Matthias Volkov
  • 121
  • 1
  • 2

3 Answers3

7

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. 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.

Using 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

bex
  • 103
  • 1
  • 5
0

Here's a strategy: subtract 5 hours from the modify times of all the .mov files, then proceed as normal:

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

webb
  • 4,180
  • 1
  • 17
  • 26
  • thanks! what I'm afraid of, though, is that if I go and take a picture in a different time zone all the mov files will now be off be a different number of hours... a better strategy might be to have a script which takes a mov file, looks for the jpg with the same name and uses exiftool to get the date right. but I wouldn't know how to write that. – Matthias Volkov Apr 28 '16 at 11:44
  • Sorry, I think I misread your question. Seems like you're using exif data from inside the files, whereas my answer affects only filesystem modification dates. Could you tell me the result of `stat a.jpg` and `stat a.mov` for a mov-jpg pair? Also, is each mov and corresponding jpg in the same folder, or at least in a systematically nearby folder? – webb Apr 28 '16 at 14:35
  • what am I looking for in the stat output? I'm seeing a bunch of dates, but none are correct (ie not even one shows 10:24:38). The way Apple Photos stores the files is a mess. I could always do a manual export, this way all the jpg and mov come in pairs (same name, different extension) all in the same folder. This last solution is not ideal, but perhaps makes it way easier to write a script? – Matthias Volkov Apr 28 '16 at 15:53
0

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). So, it appears that MediaCreateDate is being set to the UTC time, with the zone stripped off.

Edward Q. Bridges
  • 16,712
  • 8
  • 35
  • 42