Appears to be a problem with processing of the EXIF OffsetTime* tags

Started by MDEmbree, July 21, 2017, 02:44:01 PM

Previous topic - Next topic

MDEmbree

There appears to be a problem with the processing of the new EXIF OffsetTime* tags with ExifTool 10.60 and earlier, I can only add these tags in a separate ExifTool run from updating other tags.  I am running the Windows executable on Windows 10 1607 x64.

I shot a bunch of photos in the EDT (-4) TZ with my camera time TZ set to ADT (-3) which is my home TZ, so I want to update the EXIF times to show the correct EDT times. Also, since I am updating the files anyway, the camera clock was fast by 00:02:14 so I am correcting that also. Since I live in the ADT TZ, the file times are correct already and only require the -00:02:14 correction, which is why I used GlobalTimeShift. I also wanted to add EXIF OffsetTime* tags with the correct TZ value. 

I have this all working except that I can't update the EXIF OffsetTime* tags at the same time as the other time tags so need run ExifTool twice against the files. When I run ExifTool to perform all the updates at once, it completes successfully, but when I check, the OffsetTime* tags are not added. I have also tried adding each of the OffsetTime* tags explicitly, but that makes no difference.

Also when I shift the time for time:all, all the writeable times are updated except EXIF:IFD1:ModifyDate which I needed to update explicitly.

Following is an example:

>exiftool -ver
10.60

>exiftool -a -s -G0:1 -time:all DSC05891.JPG
[File:System]   FileModifyDate                  : 2017:07:19 10:31:26-03:00
[File:System]   FileAccessDate                  : 2017:07:21 15:04:37-03:00
[File:System]   FileCreateDate                  : 2017:07:21 15:04:37-03:00
[EXIF:IFD0]     ModifyDate                      : 2017:07:19 10:31:26
[EXIF:ExifIFD]  DateTimeOriginal                : 2017:07:19 10:31:26
[EXIF:ExifIFD]  CreateDate                      : 2017:07:19 10:31:26
[MakerNotes:Sony] SonyDateTime                  : 2017:07:19 10:31:26
[MakerNotes:Sony] SonyDateTime                  : 2017:07:19 10:31:26
[EXIF:IFD1]     ModifyDate                      : 2017:07:19 10:31:26

>exiftool -a -globaltimeshift "-0:2:14" "-time:all-=1:2:14" "-OffsetTime*=-4:00" "-IFD1:ModifyDate-=1:2:14" "-filemodifydate<DateTimeOriginal" "-filecreatedate<DateTimeOriginal" -overwrite_original DSC05891.JPG
    1 image files updated

>exiftool -a -s -G0:1 -time:all DSC05891.JPG
[File:System]   FileModifyDate                  : 2017:07:19 10:29:12-03:00
[File:System]   FileAccessDate                  : 2017:07:19 10:29:12-03:00
[File:System]   FileCreateDate                  : 2017:07:19 10:29:12-03:00
[EXIF:IFD0]     ModifyDate                      : 2017:07:19 09:29:12
[EXIF:ExifIFD]  DateTimeOriginal                : 2017:07:19 09:29:12
[EXIF:ExifIFD]  CreateDate                      : 2017:07:19 09:29:12
[MakerNotes:Sony] SonyDateTime                  : 2017:07:19 09:29:12
[MakerNotes:Sony] SonyDateTime                  : 2017:07:19 09:29:12
[EXIF:IFD1]     ModifyDate                      : 2017:07:19 09:29:12

>exiftool -P "-OffsetTime*=-4:00" -overwrite_original DSC05891.JPG
    1 image files updated

>exiftool -a -s -G0:1 -time:all DSC05891.JPG
[File:System]   FileModifyDate                  : 2017:07:19 10:29:12-03:00
[File:System]   FileAccessDate                  : 2017:07:19 10:29:12-03:00
[File:System]   FileCreateDate                  : 2017:07:19 10:29:12-03:00
[EXIF:IFD0]     ModifyDate                      : 2017:07:19 09:29:12
[EXIF:ExifIFD]  DateTimeOriginal                : 2017:07:19 09:29:12
[EXIF:ExifIFD]  CreateDate                      : 2017:07:19 09:29:12
[EXIF:ExifIFD]  OffsetTime                      : -04:00
[EXIF:ExifIFD]  OffsetTimeOriginal              : -04:00
[EXIF:ExifIFD]  OffsetTimeDigitized             : -04:00
[MakerNotes:Sony] SonyDateTime                  : 2017:07:19 09:29:12
[MakerNotes:Sony] SonyDateTime                  : 2017:07:19 09:29:12
[EXIF:IFD1]     ModifyDate                      : 2017:07:19 09:29:12
[Composite]     SubSecCreateDate                : 2017:07:19 09:29:12-04:00
[Composite]     SubSecDateTimeOriginal          : 2017:07:19 09:29:12-04:00
[Composite]     SubSecModifyDate                : 2017:07:19 09:29:12-04:00

>

Phil Harvey

> exiftool "-offsettime-=1:2:14" "-OffsetTime=-4:00" -v3 a.jpg
Error converting value for ExifIFD:OffsetTime (PrintConvInv)
Deleting ExifIFD:OffsetTime if value is 'xxx never delete xxx'
Warning: Error converting value for ExifIFD:OffsetTime (PrintConvInv)
Writing ExifIFD:OffsetTime if tag was deleted
...


The problem is that -time:all also includes OffsetTime tags.  And since these tags are not (yet) shiftable, -= is a conditional delete (actually a conditional replace since you are later assigning a new value), which isn't what you want to do.  (You didn't want to apply a shift to these tags either, so either way your blanket -time:all would cause problems for these tags.)

I'm afraid that the alternative is to get more specific about the time tags you want to shift.

- 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 ($).

MDEmbree

Thanks.

Time shifting *Date* or EXIF:*Date" shifts all writeable EXIF Date tags except IFD1:ModifyDate which must be shifted explicitly even though it is displayed by both wildcards.  Is this a bug?

Either of the following commands do what I want with one execution of ExifTool.

exiftool -a -globaltimeshift "-0:2:14" "-OffsetTime*=-4:00" "-*Date*-=1:2:14" "-IFD1:ModifyDate-=1:2:14" "-filemodifydate<DateTimeOriginal" "-filecreatedate<DateTimeOriginal" -overwrite_original *.JPG

exiftool -a -globaltimeshift "-0:2:14" "-OffsetTime*=-4:00" "-EXIF:*Date*-=1:2:14" "-SonyDateTime-=1:2:14" "-IFD1:ModifyDate-=1:2:14" "-filemodifydate<DateTimeOriginal" "-filecreatedate<DateTimeOriginal" -overwrite_original *.JPG


Phil Harvey

Quote from: MDEmbree on July 21, 2017, 06:27:08 PM
Time shifting *Date* or EXIF:*Date" shifts all writeable EXIF Date tags except IFD1:ModifyDate which must be shifted explicitly even though it is displayed by both wildcards.  Is this a bug?

This happens because IFD0 is the preferred location for ModifyDate, so you must specify the IFD explicitly if you want to write (or shift) it elsewhere:

> exiftool a.jpg -exif:modifydate+=1 -v3
Shifting IFD0:ModifyDate if tag exists
======== a.jpg
[...]

> exiftool a.jpg -exif:modifydate+=1 -ifd1:modifydate+=1 -v3
Shifting IFD0:ModifyDate if tag exists
Shifting IFD1:ModifyDate if tag exists
======== a.jpg
[...]


- 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 ($).