Hi all,
I took an image of my GPS logger displaying the GPS date and time.
Now I have two timestamps:
1) The one written down from the image.
2) The one from DateTimeOriginal from EXIF of the same image:
ImageDateTime: 2011:04:02 09:25:34
DateTimeOriginal: 2009:01:01 00:35:06
To fix the wrong dates of all image in the folder I need to know the time difference in the format needed by the "Date/Time Shift Feature": http://www.exiftool.org/index.html#shift
In this case this should be:
ImageDateTime: 2011:04:02 09:25:34
DateTimeOriginal: 2009:01:01 00:35:06
Difference: 2:3:1 9:10:28
and then + or -
for a command line like this:
exiftool "-DateTimeOriginal+=5:3:1 9:10:28" DIR
Ho to calculate that value automatically from the timestamps?
Thanks,
Jan
Hi Jan,
ExifTool really isn't set up to do this, but it can be done in a round-about way:
1) Use ExifTool to geotag your images:
exiftool -geosync="2011:04:02 09:25:34@2009:01:01 00:35:06" -geotag="my_track.gpx" DIR
You will have to be careful about time zones because the GPS time (the first time) is in UTC, and the file time (the 2nd time) is in the local system timezone unless otherwise specified.
2) Copy the GPS time to DateTimeOriginal:
exiftool "-datetimeoriginal<gpsdatetime" DIR
3) Shift to your preferred timezone:
exiftool -datetimeoriginal-=5 DIR
But since this is posted in the API section of the forum, I presume you are scripting this in Perl. If this is true, then it may just be easier to calculate the time difference yourself.
- Phil
Hi Phil,
indeed I found a way to calculate the right value in Perl myself.
However your approach is way easier.
Challenge is indeed the timezone in step 1.
Track:
...
GPS track start: 2011:04:02 15:02:04 UTC
GPS track end: 2011:04:02 15:12:05 UTC
For the camera then the local timezone is assumed (I am in Germany):
....
..Geotime value: 2011:04:02 13:02:26 UTC
Warning: Time is too far before track in File:Geotime (ValueConvInv)
How to deal with this?
Jan
Hi Jan,
It seems the camera timezone is different from your system timezone.
You can specify the camera timezone when setting Geotime from DateTimeOriginal by adding an argument like this to your command:
"-Geotime<${DateTimeOriginal}-05:00"
Where the camera timezone would be -05:00 in this example. (Note: Use single quotes if you are on Mac or Linux.)
Likewise, the camera timezone should be added to the time when setting Geosync:
geosync="2011:04:02 09:25:34@2009:01:01 00:35:06-05:00"
- Phil
Edit: Ooops! I should read my own documentation (https://exiftool.org/geotag.html#geosync). Both times are assumed to be local in the Geosync string. So you also need to specify a timezone for the GPS time if it isn't in the local system timezone. Also see the time synchronization example (https://exiftool.org/geotag.html#TP1).