Author Topic: Shifting datetimedigitized is incorrect for more than one file  (Read 5427 times)

gamin

  • Jr. Member
  • **
  • Posts: 22
Shifting datetimedigitized is incorrect for more than one file
« on: November 29, 2010, 10:43:00 PM »
While correcting the time in a set of CR2 and XMP files, I noticed that my XMP files sometimes ended up with the wrong time. I have not verified yet if my CR2 files have the same problem.

I can reproduce the problem like this:
Create an empty directory
Copy the two attached XMP files in this directory, name them file1.XMP and file2.XMP (the file names do not seem to matter)
Run the following:
exiftool -v5 -datetimedigitized-=0:0:5 file?.xmp
This is the result (note the time that is not shifted by exactly 5 seconds in file2.xmp)
Code: [Select]
Shifting XMP-exif:DateTimeDigitized if tag exists
======== file1.xmp
Rewriting file1.xmp...
  FileType = XMP
  MIMEType = application/rdf+xml
    - XMP-exif:DateTimeDigitized = '2010-07-28T15:35:57.59-04:00'
    + XMP-exif:DateTimeDigitized = '2010-07-28T15:35:52.59-04:00'
======== file2.xmp
Rewriting file2.xmp...
  FileType = XMP
  MIMEType = application/rdf+xml
    - XMP-exif:DateTimeDigitized = '2010-07-28T15:40:38.37-04:00'
    + XMP-exif:DateTimeDigitized = '2010-07-28T15:40:32.63-04:00'
    2 image files updated

If, under the same original conditions, I shift the time in only the second file:
exiftool -v5 -datetimedigitized-=0:0:5 file2.xmp
The time is shifted correctly, by exactly 5 seconds:
Code: [Select]
Shifting XMP-exif:DateTimeDigitized if tag exists
======== file2.xmp
Rewriting file2.xmp...
  FileType = XMP
  MIMEType = application/rdf+xml
    - XMP-exif:DateTimeDigitized = '2010-07-28T15:40:38.37-04:00'
    + XMP-exif:DateTimeDigitized = '2010-07-28T15:40:33.37-04:00'
    1 image files updated

My environment:
Code: [Select]
>uname -a
CYGWIN_NT-5.1 borduas 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
>exiftool -ver
8.40

Thanks for any explanation, workaround or fix.

Martin

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17044
    • ExifTool Home Page
Re: Shifting datetimedigitized is incorrect for more than one file
« Reply #1 on: November 30, 2010, 07:39:21 AM »
Hi Martin,

You get the prize for discovering a bug in ExifTool!

Thank you very much for pointing this out.  The problem only occurs when shifting multiple date/time values with fractional seconds.

This will be fixed in the next release.

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

gamin

  • Jr. Member
  • **
  • Posts: 22
Re: Shifting datetimedigitized is incorrect for more than one file
« Reply #2 on: November 30, 2010, 12:03:56 PM »
Phil,

The fix is enough of a prize. Thanks!

I regularly shift time by a few seconds in pictures taken with multiple cameras, to maintain a coherent timeline across multiple sets. I guess I now have many, many pictures with incorrect dates, and I deleted the originals months ago.

Do you know if:
1. this bug has always been in ExifTool?
2. the time error is limited (a second or less) or completely random?

Thanks,

Martin

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17044
    • ExifTool Home Page
Re: Shifting datetimedigitized is incorrect for more than one file
« Reply #3 on: November 30, 2010, 12:42:02 PM »
Hi Martin,

The time error is due to a bug in the handling of the fractional seconds, and does not affect times with integer seconds.  The maximum error for affected times due to this bug should be 2 seconds.

You may be able to compare affected date/time values with other values in the same file to determine the correct time.  Only XMP date/time values could be affected since other formats (EXIF and IPTC for example) do not support fractional seconds in the time string.

I apologize for any inconvenience this bug causes, and thank you again for pointing out this problem.

- Phil

Edit: I forgot about the GPS:TimeStamp tag which also supports fractional seconds.  I think this is the only non-XMP tag which could be affected.
« Last Edit: November 30, 2010, 01:39:34 PM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17044
    • ExifTool Home Page
Re: Shifting datetimedigitized is incorrect for more than one file
« Reply #4 on: November 30, 2010, 03:46:07 PM »
Hi Martin,

I have prepared a pre-release of the Perl version of Image-ExifTool-8.41, available for download here.

If would be helpful if you are able to test this out.

Thanks.

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

gamin

  • Jr. Member
  • **
  • Posts: 22
Re: Shifting datetimedigitized is incorrect for more than one file
« Reply #5 on: November 30, 2010, 08:07:43 PM »
Hi Phil,

I just tested 8.41 on about a dozen files, compared the dates after a negative shift of 5 seconds, and it seems to work properly. Thanks!

My Canon XSi does seem to generate fractional time, but not in a native tag, only in a composite, if that's what you mean by "do not support fractional seconds in the time string".

exiftool -*date* -G file_0003.cr2
Code: [Select]
[File]          File Modification Date/Time     : 2010:07:28 14:40:40-04:00
[EXIF]          Modify Date                     : 2010:07:28 15:40:33
[EXIF]          Date/Time Original              : 2010:07:28 15:40:33
[EXIF]          Create Date                     : 2010:07:28 15:40:33
[Composite]     Create Date                     : 2010:07:28 15:40:33.37
[Composite]     Date/Time Original              : 2010:07:28 15:40:33.37
[Composite]     Modify Date                     : 2010:07:28 15:40:33.37

Martin

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17044
    • ExifTool Home Page
Re: Shifting datetimedigitized is incorrect for more than one file
« Reply #6 on: December 01, 2010, 07:16:41 AM »
I just tested 8.41 on about a dozen files, compared the dates after a negative shift of 5 seconds, and it seems to work properly.

Excellent.  Thanks for testing this.

Quote
My Canon XSi does seem to generate fractional time, but not in a native tag, only in a composite, if that's what you mean by "do not support fractional seconds in the time string".

Yes.  The Composite date/time tags are not writable so they are not affected by this bug.

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