ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: chluk2425 on June 15, 2017, 05:47:34 AM

Title: Problem with iPhone photo timestamp
Post by: chluk2425 on June 15, 2017, 05:47:34 AM
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!

Title: Re: Problem with iPhone photo timestamp
Post by: Phil Harvey on June 15, 2017, 07:28:23 AM
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
Title: Re: Problem with iPhone photo timestamp
Post by: chluk2425 on June 15, 2017, 10:35:39 AM
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 ...
Title: Re: Problem with iPhone photo timestamp
Post by: Phil Harvey on June 15, 2017, 11:58:29 AM
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