Problem with iPhone photo timestamp

Started by chluk2425, June 15, 2017, 05:47:34 AM

Previous topic - Next topic

chluk2425

I think I am not the only person to deal with this problem.... I have photos export from iPhone and now would want to import them to a new device, normally photos taken by iPhone would have no problem as it will have the Date taken tag (the DateTimeOriginal). However, photos from apps like Whatsapp will have no such information and when iPhone read the photos, it will read the file creation date, which is obviously wrong. What I found is, though the Date Taken tag is missing, the File Modify Date is still the correct date where the photo is saved to my device....  So I am thinking to copy the modify date to the datetimeoriginal using the following command:

exiftool "-DateTimeOriginal<FileModifyDate" dir

However, this will apply to all, and any photos that originally have the date time taken will also be overwritten... is there a way to only change those without the DateTimeOriginal tag and apply the above command?

Any other alternative suggestions are welcomed.

Thanks!


Phil Harvey

There are a few ways to do this.  Here are two:

exiftool "-datetimeoriginal<filemodifydate" -if "not $datetimeoriginal" DIR

exiftool -datetimeoriginal-= -addtagsfromfile @ "-datetimeoriginal<filemodifydate" DIR

The first method is perhaps easier to understand, but two processing passes are performed: one to read the metadata and the second to write the file.  However, the -fast3 option could be added here to speed things up significantly.  (See the note in my signature about the quotes if you are on a Mac.)

The second method is faster because it is done in a single pass.  The trick here is that you need to specify -addTagsFromFile (as opposed to the default -tagsFromFile) when doing a conditional replacement like this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

chluk2425

Thanks! The  ` -if "not $datetimeoriginal" ' is something I did not figure out.

Just out of curious, does anyone know how to resolve the similar problem in iPhone Videos? Where videos in iPhone are displaying the correct date but when export to PC and reimport to another iPhone the date became the date of which it is imported... I can't figure out which tag I should modify to get the date correct ...

Phil Harvey

The first question is:  Is is the export or the import that is changing the times?

If the import, then exiftool can't help you (unless you are running exiftool on your phone, which is possible, but unlikely).

If the export, then you could use the shotgun approach:

exiftool -time:all="SOME DATE/TIME VALUE" -wm w DIR

or if there is a tag that still contains the correct date/time:

exiftool "-time:all<SOURCE_TAG" -wm w DIR

The -wm w tells exiftool to write only existing tags.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).