immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
39.4k stars 1.86k forks source link

Exif date/time isn't parsed correctly #9331

Open ygaeon opened 2 months ago

ygaeon commented 2 months ago

The bug

(Note this might be related to / same as #4898)

We have two different models of phones,

Both cameras sync to Immich server but our photos are not in order and I started investigating.

My photos are saved with wrong date/timestamp. I'm currently in UTC+2 (Stockholm/Europe). Comparing EXIFs (exiftool 12.76):

Photos

Fairphone 4:

File Name                       : IMG_20240504_164142.jpg

File Modification Date/Time     : 2024:05:04 16:41:42+02:00
File Access Date/Time           : 2024:05:06 19:05:53+02:00 *
File Inode Change Date/Time     : 2024:05:06 19:06:02+02:00 *

Date/Time Original              : 2024:05:04 16:41:42
Create Date                     : 2024:05:04 16:41:42

Create Date                     : 2024:05:04 16:41:42.809319
Date/Time Original              : 2024:05:04 16:41:42.809319
Modify Date                     : 2024:05:04 16:41:42.809319

* <- when I syncthing'd it

This Date/Time is translated to

05/04/2024, 06:41 PM (18:41)
Africa/Blantyre (+02:00)

Wrong time, wrong timezone ...

Samsung Galaxy Note 10:

File Name                       : 20240504_153307.jpg

File Modification Date/Time     : 2024:05:04 15:33:09+02:00
File Access Date/Time           : 2024:05:04 15:33:09+02:00
File Inode Change Date/Time     : 2024:05:06 20:02:35+02:00

Date/Time Original              : 2024:05:04 15:33:08
Create Date                     : 2024:05:04 15:33:08

Create Date <-- SGN10 doesn't have this at this pos
Date/Time Original              : 2024:05:04 15:33:08+02:00
Modify Date                     : 2024:05:04 15:33:08+02:00

This Date/Time is translated to

05/04/2024, 03:33 PM (15:33)
Africa/Blantyre (+02:00)

Correct time, wrong timezone ...

Videos

Fairphone 4:

File Name                       : VID_20240504_164249.mp4

File Modification Date/Time     : 2024:05:04 16:44:35+02:00
File Access Date/Time           : 2024:05:06 19:06:24+02:00 *
File Inode Change Date/Time     : 2024:05:06 19:06:34+02:00 *

Create Date                     : 2024:05:04 14:44:35
Modify Date                     : 2024:05:04 14:44:35

Track Create Date               : 2024:05:04 14:44:35
Track Modify Date               : 2024:05:04 14:44:35

Media Create Date               : 2024:05:04 14:44:35
Media Modify Date               : 2024:05:04 14:44:35

* <- when I syncthing'd it

This Date/Time is translated to

05/04/2024, 02:44 PM (14:44)
Africa/Abidjan (+00:00)

Which kind of translates to "correct" even if the correct should be "05/04/2024, 04:44 PM (16:44), Europe/Stockholm (+02:00)"

Samsung Galaxy Note 10:

File Name                       : 20240504_154055.mp4

File Modification Date/Time     : 2024:05:04 15:41:04+02:00
File Access Date/Time           : 2024:05:04 15:41:04+02:00
File Inode Change Date/Time     : 2024:05:06 20:02:52+02:00

Create Date                     : 2024:05:04 13:41:04
Modify Date                     : 2024:05:04 13:41:04

Track Create Date               : 2024:05:04 13:41:04
Track Modify Date               : 2024:05:04 13:41:04

Media Create Date               : 2024:05:04 13:41:04
Media Modify Date               : 2024:05:04 13:41:04

This Date/Time is translated to

05/04/2024, 03:41 PM (15:41)
Africa/Blantyre (+02:00)

Correct time, wrong timezone ...

From https://web.archive.org/web/20180921145139if_/http://www.cipa.jp:80/std/documents/e/DC-010-2017_E.pdf one can read:

From https://en.wikipedia.org/wiki/ISO_8601 on can read:

Now, this is clearly not what's happening in Fairphone 4 case above:

Something is clearly not being parsed correctly somewhere .. and I have thousands of photos that are sorted wrongly in the archive now ..

Please advice ..

The OS that Immich Server is running on

Debian

Version of Immich Server

v1.99.0

Version of Immich Mobile App

1.100.0 build.130

Platform with the issue

Your docker-compose.yml content

N/A .. running podman

podman pod create --name pod-immich --hostname immich --publish 2283:3001

podman run -d --pod pod-immich --name immich_redis redis:6.2-alpine

podman run -d --pod pod-immich --name immich_postgres --env-file $DP/immich.env --volume $DP/postgres:/var/lib/postgresql/data tensorchord/pgvecto-rs:pg14-v0.2.0

podman run -d --pod pod-immich --name immich_machine_learning --env-file $DP/immich.env --volume $DP/model-cache:/cache immich-machine-learning:v1.99.0

podman run -d --pod pod-immich --name immich_server --env-file $DP/immich.env --volume $DP/upload:/usr/src/app/upload --volume /etc/localtime:/etc/localtime:ro immich-server:v1.99.0 start.sh immich

podman run -d --pod pod-immich --name immich_microservices --env-file $DP/immich.env --volume $DP/upload:/usr/src/app/upload --volume /etc/localtime:/etc/localtime:ro immich-server:v1.99.0 start.sh microservices

Your .env content

# General
TZ="Europe/Stockholm"

# Database
DB_HOSTNAME=immich_postgres
DB_USERNAME=immich
DB_PASSWORD=xxxxx

DB_DATABASE=immich
DB_DATABASE_NAME=immich

# Postgres
POSTGRES_USER=immich
POSTGRES_PASSWORD=xxxxx
POSTGRES_DB=immich

# Redis
REDIS_HOSTNAME=immich_redis

Reproduction steps

N/A

Relevant log output

No response

Additional information

No response

scrampker commented 2 months ago

I'm seeing similar problems on my GrapheneOS phone as well. Seems to impact videos and photos differently. Sometimes tagged with local time zone, other times, UTC. -- but odd, because it's not just the wrong time zone, it can be the wrong day in UTC. IE videos I took last night are saying they're in the future -- for tonight.

fmartingr commented 2 months ago

I see similar issues on my end. In my case I my pictures where saved into iCloud Photos from a DJI Osmo 3, and when the app imported them into Immich the datetime was wrong by 2 hours.

I removed all pictures and tried to import them manually via the web interface, same result.

Attaching one of the pictures that has that issue.

DJI_20240511164405_0094_D.JPG

scrampker commented 2 months ago

Yeah most of my issues result from my Osmo Pocket 3 as well. My guess is this is because the photos lack GPS data, but it would be nice if it still had accurate time.

One thing I considered is that I tend to rename the lrf files to MP4 so I can upload those, and I keep the full size media elsewhere for editing. Perhaps DJI does something weird with the LRF exif.

-------- Original Message -------- On 5/12/24 2:31 AM, Felipe Martin wrote:

I see similar issues on my end. In my case I my pictures where saved into iCloud Photos from a DJI Osmo 3, and when the app imported them into Immich the datetime was wrong by 2 hours.

I removed all pictures and tried to import them manually via the web interface, same result.

Attaching one of the pictures that has that issue.

DJI_20240511164405_0094_D.JPG

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

ygaeon commented 1 month ago

Anyone from the project that can comment back?

TekkertheChaot commented 1 month ago

Chiming in; same behavior here with older photos shot on a Motorola Moto G (1. Gen), additionaly it dates it far back (photo from 2016, Immich dates it as 2002) For comparison, Windows Explorer seems to parse the information correctly. I have my external library bound via a read only share, might this be a cause for the metadata not being processed correctly? (I am aware that manual changes to the metadata to these files cannot be saved, as it has no write access on the source folder)

grafik

EDIT: Okay, I just learned that Windows Explorer doesn't always read EXIF data. In my case, windows explorer read the base file attribute but there ACTUALLY IS a "Created"-Date with an actual 2002-date for some reason (inspected with ExifTool). Hopefully that helps some people further diagnosing their metadata ✌️ grafik

ygaeon commented 1 month ago

2 weeks later: "Anyone from the project that can comment back?"

alextran1502 commented 1 month ago

Are you on the latest version of the mobile app/server?

ygaeon commented 1 month ago

Was at the time of reporting, yes .. .. and it's unfortunately a bit of a hassle to update so I refrained from doing so until had some feedback in this thread :-)

alextran1502 commented 1 month ago

I am pretty sure the latest version was v1.105.0 two weeks ago. Can you help upgrade it and test it again? Also include the troubled file will help with troubleshooting as well.

fmartingr commented 1 month ago

I just updated to v1.105.1 and refreshed the metadata for my entire library, still having the same issue. Sample file in my previous comment.

ygaeon commented 1 month ago

Just updated to

Tested and it is still borked ..

ygaeon commented 1 month ago

Attached sample file ...

IMG_20240605_002021.jpg

That becomes like follows in Immich ...

2024-06-06_09-06