Skip to content

Wrong date recognition order #20552

Description

@Fricsion

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • Yes

The bug

I have a media file whose metadata look like this:

% exiftool [redacted].mov
ExifTool Version Number         : 13.10
File Name                       : [redacted].mov
Directory                       : [redacted]
File Size                       : 29 MB
File Modification Date/Time     : 2025:07:31 20:48:58+09:00
File Access Date/Time           : 2025:08:02 16:53:22+09:00
File Inode Change Date/Time     : 2025:08:02 17:04:33+09:00
File Permissions                : -rw-r--r--
File Type                       : MOV
File Type Extension             : mov
MIME Type                       : video/quicktime
Major Brand                     : Apple QuickTime (.MOV/QT)
Minor Version                   : 0.0.0
Compatible Brands               : qt
Movie Header Version            : 0
Create Date                     : 2025:07:28 13:23:06
Modify Date                     : 2025:07:28 13:23:08
Time Scale                      : 600
Duration                        : 15.27 s
Preferred Rate                  : 1
Preferred Volume                : 100.00%
Preview Time                    : 0 s
Preview Duration                : 0 s
Poster Time                     : 0 s
Selection Time                  : 0 s
Selection Duration              : 0 s
Current Time                    : 0 s
Next Track ID                   : 6
Track Header Version            : 0
Track Create Date               : 2025:07:28 13:23:06
Track Modify Date               : 2025:07:28 13:23:08
Track ID                        : 1
Track Duration                  : 15.27 s
Track Layer                     : 0
Track Volume                    : 100.00%
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 44100
Purchase File Format            : mp4a
Image Width                     : 1920
Image Height                    : 1080
Clean Aperture Dimensions       : 1920x1080
Production Aperture Dimensions  : 1920x1080
Encoded Pixels Dimensions       : 1920x1080
Graphics Mode                   : ditherCopy
Op Color                        : 32768 32768 32768
Compressor ID                   : avc1
Source Image Width              : 1920
Source Image Height             : 1080
X Resolution                    : 72
Y Resolution                    : 72
Compressor Name                 : H.264
Bit Depth                       : 24
Video Frame Rate                : 29.997
Camera Lens Model	  	      : [redacted]
Camera Focal Length 35mm Equivalent : 29
Warning                         : [minor] The ExtractEmbedded option may find more tags in the media data [x12]
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Content Describes               : Track 2
Media Header Version            : 0
Media Create Date               : 2025:07:28 13:23:06
Media Modify Date               : 2025:07:28 13:23:08
Media Time Scale                : 600
Media Duration                  : 15.27 s
Media Language Code             : und
Gen Media Version               : 0
Gen Flags                       : 0 0 0
Gen Graphics Mode               : ditherCopy
Gen Op Color                    : 32768 32768 32768
Gen Balance                     : 0
Handler Class                   : Data Handler
Handler Vendor ID               : Apple
Handler Description             : Core Media Data Handler
Meta Format                     : mebx
Handler Type                    : Metadata Tags
Make                            : Apple
Model                           : [redacted]
Software                        : [redacted]
Creation Date                   : 2024:09:09 09:36:40+09:00
Media Data Size                 : 29059573
Media Data Offset               : 18175
Camera Lens Model               : [redacted]
Camera Focal Length 35mm Equivalent: 29
Image Size                      : 1920x1080
Megapixels                      : 2.1
Avg Bitrate                     : 15.2 Mbps
Rotation                        : 90

And Immich should recognize its date captured and show in the right place on timeline.
Immich seems to load the values in this order:

/** look for a date from these tags (in order) */
const EXIF_DATE_TAGS: Array<keyof Tags> = [
'SubSecDateTimeOriginal',
'DateTimeOriginal',
'SubSecCreateDate',
'CreationDate',
'CreateDate',
'SubSecMediaCreateDate',
'MediaCreateDate',
'DateTimeCreated',
];

'SubSecDateTimeOriginal',
  'DateTimeOriginal',
  'SubSecCreateDate',
  'CreationDate',
  'CreateDate',
  'SubSecMediaCreateDate',
  'MediaCreateDate',
  'DateTimeCreated',

Since my media file has Creation Date & Create Date, it should use its Creation Date for the timeline placement. (2024:09:09 09:36:40+09:00)
But when I upload the file, it will go in a wrong datetime (2025:07:28 13:23:06)

I tried refreshing the metadata of the entire server.

The OS that Immich Server is running on

Ubuntu 24.04.2 LTS (GNU/Linux 6.8.0-71-generic x86_64)

Version of Immich Server

v1.137.3

Version of Immich Mobile App

Not applicable.

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich_ts:
      image: tailscale/tailscale:latest
      hostname: photos
      environment:
        - TS_AUTHKEY=[redacted]
        - TS_STATE_DIR=/var/lib/tailscale
        - TS_USERSPACE=false
      volumes:
        - ./tailscale-immich/state:/var/lib/tailscale
      devices:
        - /dev/net/tun:/dev/net/tun
      cap_add:
        - net_admin
      restart: unless-stopped

  immich_proxy:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: immich_npm
    restart: unless-stopped
    volumes:
      - ./nginx/data:/data
      - ./nginx/letsencrypt:/etc/letsencrypt
    network_mode: service:immich_ts

  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - ./external-library:/srv/external-library
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/valkey/valkey:8-bookworm@sha256:42cba146593a5ea9a622002c1b7cba5da7be248650cbb64ecb9c6c33d29794b1
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
      # Uncomment the DB_STORAGE_TYPE: 'HDD' var if your database isn't stored on SSDs
      # DB_STORAGE_TYPE: 'HDD'
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    restart: always

volumes:
  model-cache:

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

TZ="Asia/Tokyo"

# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
DB_DATA_LOCATION=./postgres

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
DB_PASSWORD=[redacted]

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

  1. docker compose up -d
  2. upload the media file

Relevant log output

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions