Specifying camera time zone in command line

Started by glendeni, October 27, 2018, 03:50:32 PM

Previous topic - Next topic

glendeni

I am having difficulty implementing the specification of camera time zone when using the -geosync="...@..." option with exiftool in a Linux command line.

I have an image with DateTimeOriginal=2018:09:20 15:15:13 - there is no time zone info in the image exif data.  The GPX track time for its location is 2018-09-20T23:11:02Z.  So I would like to georeference the image using the in-file times of each, i.e. using -geosync="23:11:02@2018:09:20 15:15:13".

The camera time is always PST (though local time for that date is PDT).  From the "examples" I thought I could add '-geotime<${DateTimeOriginal}+08:00' (the quotes being included per the example) - but the image file is unchanged and I get a "Warning: No writable tags ..." message.

I _can_ get a correct georeferencing by not using '-geotime<${DateTimeOriginal}-08:00' and simply using a 7 hr difference for this case ala -geosync="16:11:02@2018:09:20 15:15:13". But not specifying the camera time zone would be a major pain since apparently exiftool will "automatically" assume that the camera is in "local" time and thus be changing between PST or PDT whereas the camera time is always PST - so I would need to be constantly trying to figure out if the image date is a PDT or PST time.

PS: while I am using a file for test purposes, I intend to georeference multiple directories using the "Camera clock drift correction" feature, so applying a single-file correction is not viable.

StarGeek

Quote from: glendeni on October 27, 2018, 03:50:32 PM
The camera time is always PST (though local time for that date is PDT).  From the "examples" I thought I could add '-geotime<${DateTimeOriginal}+08:00' (the quotes being included per the example) - but the image file is unchanged and I get a "Warning: No writable tags ..." message.

I _can_ get a correct georeferencing by not using '-geotime<${DateTimeOriginal}-08:00'

Are you using -08:00 or +08:00?  You should be using -08:00 as that would be the correct time zone for PST.  With the correct time zone, the command should work.

I created a GPX file with one location and a time stamp of 2018:09:20 23:11:02Z as you have.  I set the time of a test file to the same as your example, 2018:09:20 15:15:13.   I then used the command
exiftool -P -overwrite_original  "-geotime<${DateTimeOriginal}-08:00" -geotag=x.gpx y:\!temp\aa\DSC04835.jpg
and it correctly added the GPS location from the GPX file. 

Output (MyGPS is my shortcut to display all the GPS data)
C:\>exiftool -g1 -a -s -xmp:all x.gpx
---- XMP ----
GpxVersion                      : 1.0
GpxCreator                      : ExifTool 11.13
GpxXmlns                        : http://www.topografix.com/GPX/1/0
GpxTrkNumber                    : 1
GpxTrkTrksegTrkptLat            : 34.0522342000061
GpxTrkTrksegTrkptLon            : -118.243684900011
GpxTrkTrksegTrkptEle            : 10
GpxTrkTrksegTrkptTime           : 2018:09:20 23:11:02Z
---- XMP-xsi ----
GpxSchemaLocation               : http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd

C:\>exiftool -g1 -a -s -DateTimeOriginal -MyGPS y:\!temp\aa\DSC04835.jpg
---- ExifIFD ----
DateTimeOriginal                : 2018:09:20 15:15:13

C:\>exiftool -P -overwrite_original  "-geotime<${DateTimeOriginal}-08:00" -geotag=x.gpx y:\!temp\aa\DSC04835.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -DateTimeOriginal -MyGPS y:\!temp\aa\DSC04835.jpg
---- ExifIFD ----
DateTimeOriginal                : 2018:09:20 15:15:13
---- GPS ----
GPSVersionID                    : 2.3.0.0
GPSLatitudeRef                  : North
GPSLatitude                     : 34 deg 3' 8.04"
GPSLongitudeRef                 : West
GPSLongitude                    : 118 deg 14' 37.27"
GPSAltitudeRef                  : Above Sea Level
GPSAltitude                     : 10 m
GPSTimeStamp                    : 23:15:13
GPSDateStamp                    : 2018:09:20
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

glendeni

Quote"Are you using -08:00 or +08:00?  You should be using -08:00 as that would be the correct time zone for PST.  With the correct time zone, the command should work."

I'm glad to hear it works for someone.  Actually I tried both - from the way the option looked I thought it should be a "+" but I'm used to thinking I live in a "-8" zone so also tried that.  Just in case I'm missing something, a (shortened) cut+past of the command I tried was:

exiftool -geotag "$LAPTOP/.../HeadlandsHike.gpx" "-geotime<${DateTimeOriginal}-08:00" -geosync="23:11:02@2018:09:20 15:15:13" "$LAPTOP/.../HeadlandsHike/IMG_6157.JPG"

with result

  Warning: No writable tags set ...
    0 image files updated
    1 image files unchanged

FWIW I'm running version 9.46 and have not had another other problems using exiftool, eg have been able to insert tags when not using the "-geotime" option

glendeni

PS: just to double-check it works _without_ the -geotime argument, I pulled up the command I'd used from history, removed that argument and in the -geosync argument replaced the "23" with "16" and it worked, with output

     1 image files updated


StarGeek

Since you're on linux, swap my double quotes for single quotes, especially when including a dollar sign in the argument, to prevent bash from treating it as a bash variable.

I think Geosync note #3 is key to the problem.
        Both the GPS and the image times are assumed to be local unless another timezone is specified

When you put 23:11:02 in for GPSTIME, it's assumed to be local time.  Which would be 2018:09:21 06:11:02 UTC (I think, assuming you are in Pacific TZ) and would be out of range of the GPX track.  If you change it to -geosync="23:11:02Z@15:15:13" (add the Z to show it's UTC time), it would write correctly.  When you change the 23 to 16, you're correcting for the local time zone difference (2018:09:20 is PDT, -07:00) and that allows exiftool to sync properly.

Personally, I'd think that adding the time zone to geotime and letting exiftool work out the time sync calculations is less likely to induce errors.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

glendeni

Did not know I could use a "Z" in the -geosync, had not seen that in any examples.  Did switch -geosync to "23:11:02Z@..." - and it worked!  Thank you!!  I would likely never have thought of that because I'd already read note#3 and was, as it suggested, trying to specify the camera clock time zone and had assumed -geotime was the way to do that because of this example from https://exiftool.org/geotag.html

QuoteGeotag images for which the camera clock was set to UTC (+00:00), using the time from DateTimeOriginal:
exiftool -geotag trk.gpx '-geotime<${DateTimeOriginal}+00:00' dir

altering it for my PST camera clock case.  So I would likely have continued trying to get 'geotime to work without success.  Again, thank you.

(BTW I'd use single-quotes in my original per the example I'd read then switched to double-quotes after reading that had worked for you - but bottom-line, neither worked for me.)