Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata: UTC should be overridden by local time with unknown zone #2876

Closed
mrlimacz opened this issue Nov 9, 2022 · 12 comments
Closed

Metadata: UTC should be overridden by local time with unknown zone #2876

mrlimacz opened this issue Nov 9, 2022 · 12 comments
Assignees
Labels
bug Something isn't working released Available in the stable release

Comments

@mrlimacz
Copy link

mrlimacz commented Nov 9, 2022

I have a picture taken with an iPhone 14 around 13:30 GMT+1. Picture does not have any GPS data. Exiftool snippet below.

$ exiftool -G IMG_4921.jpg | grep -i 'Date\|Offset\|GPS'
[File]          File Modification Date/Time     : 2022:09:23 14:30:04+02:00
[File]          File Access Date/Time           : 2022:11:09 22:13:26+01:00
[File]          File Inode Change Date/Time     : 2022:11:09 22:12:58+01:00
[EXIF]          Modify Date                     : 2022:09:23 13:30:04
[EXIF]          Date/Time Original              : 2022:09:23 13:30:04
[EXIF]          Create Date                     : 2022:09:23 13:30:04
[EXIF]          Offset Time                     : +01:00
[EXIF]          Offset Time Original            : +01:00
[EXIF]          Offset Time Digitized           : +01:00
[EXIF]          GPS Version ID                  : 2.2.0.0
[EXIF]          GPS Altitude Ref                : Above Sea Level
[EXIF]          GPS Horizontal Positioning Error: 13.18486582 m
[EXIF]          Thumbnail Offset                : 2534
[ICC_Profile]   Profile Date Time               : 2022:01:01 00:00:00
[Composite]     Create Date                     : 2022:09:23 13:30:04.630+01:00
[Composite]     Date/Time Original              : 2022:09:23 13:30:04.630+01:00
[Composite]     Modify Date                     : 2022:09:23 13:30:04+01:00

When imported to Photoprism, it is displayed as taken 12:30:04 local time, but actually it is actually UTC
image

I would expect the timestamp to be 13:30:04 of local time. I have the same problems with other iPhone photos (taken in 2021 and 2022 with iPhone 6s and 14). Other pictures, taken with Samsung S8 are imported correctly. One thing I noticed is that iPhone pictures have Offset Time tags, but Samsung's photos don't. I sent the photo to samples email.

I am using the latest image with MariaDB.

@mrlimacz mrlimacz added the bug Something isn't working label Nov 9, 2022
@lastzero
Copy link
Member

lastzero commented Nov 9, 2022

Please use "exiftool -n -g filename". Also, if you want us to test this, we require a file sample: https://photoprism.app/contact

@lastzero lastzero added help wanted Well suited for external contributors! needs-analysis Requires further investigation waiting Impediment / blocked / waiting and removed bug Something isn't working labels Nov 9, 2022
@mrlimacz
Copy link
Author

mrlimacz commented Nov 9, 2022

I already sent to photo to your email address.

$ exiftool -n -g IMG_4921.jpg | grep -i 'Date\|Offset\|GPS'
File Modification Date/Time     : 2022:09:23 14:30:04+02:00
File Access Date/Time           : 2022:11:09 22:13:26+01:00
File Inode Change Date/Time     : 2022:11:09 22:12:58+01:00
Modify Date                     : 2022:09:23 13:30:04
Date/Time Original              : 2022:09:23 13:30:04
Create Date                     : 2022:09:23 13:30:04
Offset Time                     : +01:00
Offset Time Original            : +01:00
Offset Time Digitized           : +01:00
GPS Version ID                  : 2 2 0 0
GPS Altitude Ref                : 0
GPS Horizontal Positioning Error: 13.18486582
Thumbnail Offset                : 2534
Profile Date Time               : 2022:01:01 00:00:00
Create Date                     : 2022:09:23 13:30:04.630+01:00
Date/Time Original              : 2022:09:23 13:30:04.630+01:00
Modify Date                     : 2022:09:23 13:30:04+01:00

@lastzero
Copy link
Member

lastzero commented Nov 9, 2022

Was this file directly created as JPEG by an iPhone or did you convert it from HEIC, either manually or automatically when syncing / uploading? Never this this before and we have a lot of iPhone users...

@lastzero
Copy link
Member

lastzero commented Nov 9, 2022

I guess the solution is to use "SubSecDateTimeOriginal" since "CreateDate" does not contain the offset directly. For whatever reason the offset is exclusively in "OffsetTime", although the other timestamps include it as expected:

  "FileModifyDate": "2022:11:09 22:51:58+01:00",
  "FileAccessDate": "2022:11:09 22:52:00+01:00",
  "FileInodeChangeDate": "2022:11:09 22:51:59+01:00",
  "ModifyDate": "2022:09:23 13:30:04",
  "DateTimeOriginal": "2022:09:23 13:30:04",
  "CreateDate": "2022:09:23 13:30:04",
  "ProfileDateTime": "2022:01:01 00:00:00",
  "SubSecCreateDate": "2022:09:23 13:30:04.630+01:00",
  "SubSecDateTimeOriginal": "2022:09:23 13:30:04.630+01:00",
  "SubSecModifyDate": "2022:09:23 13:30:04+01:00",

@lastzero lastzero self-assigned this Nov 10, 2022
@mrlimacz
Copy link
Author

It was taken as by a friend in a HEIC format, uploaded to Google Photos and shared. I downloaded it from Google Photos and it was already a JPEG. Reached out to her to get the original, but I'm still waiting.

I actually have another example from iPhone 6s, picture taken in GMT+1 at 12:54, downloaded via USB. Sending the original via email, in the same

$ exiftool -n -g IMG_3152.JPG | grep -i 'Date\|Offset\|GPS'
File Modification Date/Time     : 2022:11:10 06:14:00+01:00
File Access Date/Time           : 2022:11:10 19:33:57+01:00
File Inode Change Date/Time     : 2022:11:10 19:30:19+01:00
Modify Date                     : 2022:11:02 12:54:16
Date/Time Original              : 2022:11:02 12:54:16
Create Date                     : 2022:11:02 12:54:16
Offset Time                     : +01:00
Offset Time Original            : +01:00
Offset Time Digitized           : +01:00
Thumbnail Offset                : 2080
Create Date                     : 2022:11:02 12:54:16.698+01:00
Date/Time Original              : 2022:11:02 12:54:16.698+01:00
Modify Date                     : 2022:11:02 12:54:16+01:00

image

@mrlimacz
Copy link
Author

The whole thing was bugging me quite a bit so I did some test. Turns out a complete rescan corrects the time to actual local time (with no changes made to the original). I took a look at the photo table in the database and after a re-scan taken_at_local is updated to the correct value.

After initial indexing

Screenshot from 2022-11-10 19-43-49
Screenshot from 2022-11-11 22-29-37

After a full re-scan

Screenshot from 2022-11-11 22-31-44
Screenshot from 2022-11-11 22-34-13

Exiftool output of the original after re-index

$ exiftool -g -j -args -time:all IMG_3152.JPG 
[{
  "SourceFile": "IMG_3152.JPG",
  "File:FileModifyDate": "2022:11:10 06:14:00+01:00",
  "File:FileAccessDate": "2022:11:11 22:22:50+01:00",
  "File:FileInodeChangeDate": "2022:11:11 22:22:34+01:00",
  "EXIF:ModifyDate": "2022:11:02 12:54:16",
  "EXIF:DateTimeOriginal": "2022:11:02 12:54:16",
  "EXIF:CreateDate": "2022:11:02 12:54:16",
  "EXIF:OffsetTime": "+01:00",
  "EXIF:OffsetTimeOriginal": "+01:00",
  "EXIF:OffsetTimeDigitized": "+01:00",
  "EXIF:SubSecTimeOriginal": 698,
  "EXIF:SubSecTimeDigitized": 698,
  "Composite:SubSecCreateDate": "2022:11:02 12:54:16.698+01:00",
  "Composite:SubSecDateTimeOriginal": "2022:11:02 12:54:16.698+01:00",
  "Composite:SubSecModifyDate": "2022:11:02 12:54:16+01:00"
}]

@lastzero
Copy link
Member

Problem might be how the built-in Exif parser and data from Exiftool interfere with each other the first time.

@mrlimacz
Copy link
Author

It would be awesome if initial indexing would read the time correctly. Indexing may be a lengthy operation when you have a lot o pictures in a single folder, so I'd like to avoid that in the future :)

@lastzero
Copy link
Member

We will improve this. It's Sunday, please give it a bit of time :)

lastzero added a commit that referenced this issue Nov 15, 2022
Signed-off-by: Michael Mayer <michael@photoprism.app>
@lastzero lastzero changed the title Incorrect timestamps of iPhone pictures with no GPS data Metadata: Accept switch back to local time if current zone is UTC Nov 15, 2022
@lastzero lastzero added bug Something isn't working and removed help wanted Well suited for external contributors! waiting Impediment / blocked / waiting needs-analysis Requires further investigation labels Nov 15, 2022
lastzero added a commit that referenced this issue Nov 15, 2022
Signed-off-by: Michael Mayer <michael@photoprism.app>
@lastzero lastzero added the please-test Ready for acceptance test label Nov 15, 2022
@lastzero
Copy link
Member

An updated preview build will be available for testing soon:

We hope you have a few minutes to let us know if it works so we can release the update tomorrow!

@lastzero lastzero changed the title Metadata: Accept switch back to local time if current zone is UTC Metadata: UTC should be overridden by local time with unknown zone Nov 15, 2022
@lastzero
Copy link
Member

Happy testing! 🎁

@mrlimacz
Copy link
Author

Everything looks fine to me :)

image

$ exiftool -j -g -args -time:all *
[
  {
    "SourceFile": "6s.jpg",
    "FileModifyDate": "2022:11:13 11:06:56+01:00",
    "FileAccessDate": "2022:11:15 23:22:31+01:00",
    "FileInodeChangeDate": "2022:11:15 23:20:39+01:00",
    "ModifyDate": "2022:09:04 17:07:55",
    "DateTimeOriginal": "2022:09:04 17:07:55",
    "CreateDate": "2022:09:04 17:07:55",
    "OffsetTime": "+02:00",
    "OffsetTimeOriginal": "+02:00",
    "OffsetTimeDigitized": "+02:00",
    "SubSecTimeOriginal": 176,
    "SubSecTimeDigitized": 176,
    "SubSecCreateDate": "2022:09:04 17:07:55.176+02:00",
    "SubSecDateTimeOriginal": "2022:09:04 17:07:55.176+02:00",
    "SubSecModifyDate": "2022:09:04 17:07:55+02:00"
  },
  {
    "SourceFile": "samsung.jpg",
    "FileModifyDate": "2022:11:07 13:40:55+01:00",
    "FileAccessDate": "2022:11:15 23:22:33+01:00",
    "FileInodeChangeDate": "2022:11:15 23:22:26+01:00",
    "ModifyDate": "2022:09:04 18:27:13",
    "DateTimeOriginal": "2022:09:04 18:27:13",
    "CreateDate": "2022:09:04 18:27:13",
    "SubSecTime": "0150",
    "SubSecTimeOriginal": "0150",
    "SubSecTimeDigitized": "0150",
    "TimeStamp": "2022:09:04 18:27:13+02:00",
    "SubSecCreateDate": "2022:09:04 18:27:13.0150",
    "SubSecDateTimeOriginal": "2022:09:04 18:27:13.0150",
    "SubSecModifyDate": "2022:09:04 18:27:13.0150"
  },
  {
    "SourceFile": "11.jpg",
    "FileModifyDate": "2022:11:07 13:58:36+01:00",
    "FileAccessDate": "2022:11:15 23:22:31+01:00",
    "FileInodeChangeDate": "2022:11:15 23:21:57+01:00",
    "ModifyDate": "2022:09:04 19:43:37",
    "DateTimeOriginal": "2022:09:04 19:43:37",
    "CreateDate": "2022:09:04 19:43:37",
    "OffsetTime": "+02:00",
    "OffsetTimeOriginal": "+02:00",
    "OffsetTimeDigitized": "+02:00",
    "SubSecTimeOriginal": 218,
    "SubSecTimeDigitized": 218,
    "GPSDateStamp": "2022:09:04",
    "ProfileDateTime": "2022:01:01 00:00:00",
    "SubSecCreateDate": "2022:09:04 19:43:37.218+02:00",
    "SubSecDateTimeOriginal": "2022:09:04 19:43:37.218+02:00",
    "SubSecModifyDate": "2022:09:04 19:43:37+02:00"
  },
  {
    "SourceFile": "14.jpg",
    "FileModifyDate": "2022:11:07 14:24:50+01:00",
    "FileAccessDate": "2022:11:15 23:22:31+01:00",
    "FileInodeChangeDate": "2022:11:15 23:19:30+01:00",
    "ModifyDate": "2022:09:27 18:31:03",
    "DateTimeOriginal": "2022:09:27 18:31:03",
    "CreateDate": "2022:09:27 18:31:03",
    "OffsetTime": "+01:00",
    "OffsetTimeOriginal": "+01:00",
    "OffsetTimeDigitized": "+01:00",
    "SubSecTimeOriginal": 416,
    "SubSecTimeDigitized": 416,
    "ProfileDateTime": "2022:01:01 00:00:00",
    "SubSecCreateDate": "2022:09:27 18:31:03.416+01:00",
    "SubSecDateTimeOriginal": "2022:09:27 18:31:03.416+01:00",
    "SubSecModifyDate": "2022:09:27 18:31:03+01:00"
  }
]

@lastzero lastzero added tested Changes have been tested successfully and removed please-test Ready for acceptance test labels Nov 16, 2022
@lastzero lastzero added released Available in the stable release and removed tested Changes have been tested successfully labels Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released Available in the stable release
Projects
Status: Release 🌈
Development

No branches or pull requests

3 participants