[BUG] exif parser uses date from the future #1185

Closed
opened 2026-02-05 00:47:28 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @zegl on GitHub (Aug 4, 2023).

The bug

Hey, after importing my library of videos and photos to Immich I have two videos that have been timestamped far into the future (year 140325 and 230478 respectively).

Both videos do have corrupt exif data from before, so the root cause is not from immich, but I do believe that immich could handle this better. :-)

Both videos have similar issues, where the Create Date field is bugged out. The other fields do have correct timestamps, and the file name is another indication from when the file was originally created.

Could it be possible to ignore dates from the very distant future, and fallback to other fields? Or somehow chose the median or most common creation date?

File Name                       : 20161128_142129.mp4
Create Date                     : 140325:12:26 15:25:08
Modify Date                     : 2016:11:28 13:26:52
Track Create Date               : 0000:00:00 00:00:00
Track Modify Date               : 2016:11:28 13:26:52
Media Create Date               : 2016:11:28 13:26:52
Media Modify Date               : 2016:11:28 13:26:52
Full Exif 1
ExifTool Version Number         : 12.40
File Name                       : 20161128_142129.mp4
Directory                       : .
File Size                       : 7.1 MiB
File Modification Date/Time     : 2023:08:01 16:18:03+00:00
File Access Date/Time           : 2023:08:04 11:20:18+00:00
File Inode Change Date/Time     : 2023:08:01 16:23:54+00:00
File Permissions                : -rw-r--r--
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4 v2 [ISO 14496-14]
Minor Version                   : 0.0.0
Compatible Brands               : isom, mp42
Movie Header Version            : 1
Create Date                     : 140325:12:26 15:25:08
Modify Date                     : 2016:11:28 13:26:52
Time Scale                      : 600
Duration                        : 16.46 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                   : 3
Track Header Version            : 0
Track Create Date               : 0000:00:00 00:00:00
Track Modify Date               : 2016:11:28 13:26:52
Track ID                        : 1
Track Duration                  : 16.40 s
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 1080
Image Height                    : 1920
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 1080
Source Image Height             : 1920
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Buffer Size                     : 83008
Max Bitrate                     : 5789784
Average Bitrate                 : 3442920
Video Frame Rate                : 30
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2016:11:28 13:26:52
Media Modify Date               : 2016:11:28 13:26:52
Media Time Scale                : 44100
Media Duration                  : 16.46 s
Media Language Code             : eng
Handler Description             : IsoMedia File Produced by Google, 5-11-2011
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 44100
Handler Type                    : Metadata
Handler Vendor ID               : Apple
Media Data Size                 : 7453099
Media Data Offset               : 6757
Image Size                      : 1080x1920
Megapixels                      : 2.1
Avg Bitrate                     : 3.62 Mbps
Full Exif 2
ExifTool Version Number         : 12.40
File Name                       : VIDEO_161111_115236_335-715791211.avi
Directory                       : 230478/230478-01-12
File Size                       : 2.2 MiB
File Modification Date/Time     : 2023:08:01 16:18:09+00:00
File Access Date/Time           : 2023:08:04 11:32:58+00:00
File Inode Change Date/Time     : 2023:08:01 16:23:58+00:00
File Permissions                : -rw-r--r--
File Type                       : MP4
File Type Extension             : mp4
MIME Type                       : video/mp4
Major Brand                     : MP4 v2 [ISO 14496-14]
Minor Version                   : 0.0.0
Compatible Brands               : isom, mp42
Movie Header Version            : 1
Create Date                     : 230478:01:12 01:36:56
Modify Date                     : 2016:11:26 08:00:18
Time Scale                      : 600
Duration                        : 7.75 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                   : 3
Track Header Version            : 0
Track Create Date               : 0000:00:00 00:00:00
Track Modify Date               : 2016:11:26 08:00:18
Track ID                        : 1
Track Duration                  : 7.70 s
Track Layer                     : 0
Track Volume                    : 0.00%
Image Width                     : 1080
Image Height                    : 1920
Graphics Mode                   : srcCopy
Op Color                        : 0 0 0
Compressor ID                   : avc1
Source Image Width              : 1080
Source Image Height             : 1920
X Resolution                    : 72
Y Resolution                    : 72
Bit Depth                       : 24
Buffer Size                     : 114217
Max Bitrate                     : 2807896
Average Bitrate                 : 2180792
Video Frame Rate                : 30
Matrix Structure                : 1 0 0 0 1 0 0 0 1
Media Header Version            : 0
Media Create Date               : 2016:11:26 08:00:18
Media Modify Date               : 2016:11:26 08:00:18
Media Time Scale                : 44100
Media Duration                  : 7.76 s
Media Language Code             : eng
Handler Type                    : Audio Track
Handler Description             : IsoMedia File Produced by Google, 5-11-2011
Balance                         : 0
Audio Format                    : mp4a
Audio Channels                  : 2
Audio Bits Per Sample           : 16
Audio Sample Rate               : 44100
Media Data Size                 : 2285147
Media Data Offset               : 3790
Image Size                      : 1080x1920
Megapixels                      : 2.1
Avg Bitrate                     : 2.36 Mbps
Rotation                        : 0

The OS that Immich Server is running on

Ubuntu

Version of Immich Server

v1.71.0

Version of Immich Mobile App

/

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

N/A

Your .env content

N/A

Reproduction steps

1. Upload a file with corrupt EXIF data (see above)
2. The timestamp from year 230478 is used.

Additional information

No response

Originally created by @zegl on GitHub (Aug 4, 2023). ### The bug Hey, after importing my library of videos and photos to Immich I have two videos that have been timestamped far into the future (year 140325 and 230478 respectively). Both videos do have corrupt exif data from before, so the root cause is not from immich, but I do believe that immich could handle this better. :-) Both videos have similar issues, where the `Create Date` field is bugged out. The other fields do have correct timestamps, and the file name is another indication from when the file was originally created. Could it be possible to ignore dates from the _very distant_ future, and fallback to other fields? Or somehow chose the median or most common creation date? ``` File Name : 20161128_142129.mp4 Create Date : 140325:12:26 15:25:08 Modify Date : 2016:11:28 13:26:52 Track Create Date : 0000:00:00 00:00:00 Track Modify Date : 2016:11:28 13:26:52 Media Create Date : 2016:11:28 13:26:52 Media Modify Date : 2016:11:28 13:26:52 ``` <details> <summary>Full Exif 1</summary> ``` ExifTool Version Number : 12.40 File Name : 20161128_142129.mp4 Directory : . File Size : 7.1 MiB File Modification Date/Time : 2023:08:01 16:18:03+00:00 File Access Date/Time : 2023:08:04 11:20:18+00:00 File Inode Change Date/Time : 2023:08:01 16:23:54+00:00 File Permissions : -rw-r--r-- File Type : MP4 File Type Extension : mp4 MIME Type : video/mp4 Major Brand : MP4 v2 [ISO 14496-14] Minor Version : 0.0.0 Compatible Brands : isom, mp42 Movie Header Version : 1 Create Date : 140325:12:26 15:25:08 Modify Date : 2016:11:28 13:26:52 Time Scale : 600 Duration : 16.46 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 : 3 Track Header Version : 0 Track Create Date : 0000:00:00 00:00:00 Track Modify Date : 2016:11:28 13:26:52 Track ID : 1 Track Duration : 16.40 s Track Layer : 0 Track Volume : 0.00% Image Width : 1080 Image Height : 1920 Graphics Mode : srcCopy Op Color : 0 0 0 Compressor ID : avc1 Source Image Width : 1080 Source Image Height : 1920 X Resolution : 72 Y Resolution : 72 Bit Depth : 24 Buffer Size : 83008 Max Bitrate : 5789784 Average Bitrate : 3442920 Video Frame Rate : 30 Matrix Structure : 1 0 0 0 1 0 0 0 1 Media Header Version : 0 Media Create Date : 2016:11:28 13:26:52 Media Modify Date : 2016:11:28 13:26:52 Media Time Scale : 44100 Media Duration : 16.46 s Media Language Code : eng Handler Description : IsoMedia File Produced by Google, 5-11-2011 Balance : 0 Audio Format : mp4a Audio Channels : 2 Audio Bits Per Sample : 16 Audio Sample Rate : 44100 Handler Type : Metadata Handler Vendor ID : Apple Media Data Size : 7453099 Media Data Offset : 6757 Image Size : 1080x1920 Megapixels : 2.1 Avg Bitrate : 3.62 Mbps ``` </details> <details> <summary>Full Exif 2</summary> ``` ExifTool Version Number : 12.40 File Name : VIDEO_161111_115236_335-715791211.avi Directory : 230478/230478-01-12 File Size : 2.2 MiB File Modification Date/Time : 2023:08:01 16:18:09+00:00 File Access Date/Time : 2023:08:04 11:32:58+00:00 File Inode Change Date/Time : 2023:08:01 16:23:58+00:00 File Permissions : -rw-r--r-- File Type : MP4 File Type Extension : mp4 MIME Type : video/mp4 Major Brand : MP4 v2 [ISO 14496-14] Minor Version : 0.0.0 Compatible Brands : isom, mp42 Movie Header Version : 1 Create Date : 230478:01:12 01:36:56 Modify Date : 2016:11:26 08:00:18 Time Scale : 600 Duration : 7.75 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 : 3 Track Header Version : 0 Track Create Date : 0000:00:00 00:00:00 Track Modify Date : 2016:11:26 08:00:18 Track ID : 1 Track Duration : 7.70 s Track Layer : 0 Track Volume : 0.00% Image Width : 1080 Image Height : 1920 Graphics Mode : srcCopy Op Color : 0 0 0 Compressor ID : avc1 Source Image Width : 1080 Source Image Height : 1920 X Resolution : 72 Y Resolution : 72 Bit Depth : 24 Buffer Size : 114217 Max Bitrate : 2807896 Average Bitrate : 2180792 Video Frame Rate : 30 Matrix Structure : 1 0 0 0 1 0 0 0 1 Media Header Version : 0 Media Create Date : 2016:11:26 08:00:18 Media Modify Date : 2016:11:26 08:00:18 Media Time Scale : 44100 Media Duration : 7.76 s Media Language Code : eng Handler Type : Audio Track Handler Description : IsoMedia File Produced by Google, 5-11-2011 Balance : 0 Audio Format : mp4a Audio Channels : 2 Audio Bits Per Sample : 16 Audio Sample Rate : 44100 Media Data Size : 2285147 Media Data Offset : 3790 Image Size : 1080x1920 Megapixels : 2.1 Avg Bitrate : 2.36 Mbps Rotation : 0 ``` </details> ### The OS that Immich Server is running on Ubuntu ### Version of Immich Server v1.71.0 ### Version of Immich Mobile App / ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML N/A ``` ### Your .env content ```Shell N/A ``` ### Reproduction steps ```bash 1. Upload a file with corrupt EXIF data (see above) 2. The timestamp from year 230478 is used. ``` ### Additional information _No response_
Author
Owner

@uhthomas commented on GitHub (Aug 6, 2023):

Possibly resolved by https://github.com/immich-app/immich/pull/2908

@uhthomas commented on GitHub (Aug 6, 2023): Possibly resolved by https://github.com/immich-app/immich/pull/2908
Author
Owner

@zegl commented on GitHub (Aug 8, 2023):

Nice to hear, once that possible fix is out, I'll test again and report back with the results. 👍

@zegl commented on GitHub (Aug 8, 2023): Nice to hear, once that possible fix is out, I'll test again and report back with the results. 👍
Author
Owner

@pentix commented on GitHub (Sep 27, 2023):

Same issue here! After upgrading to 1.79.1 I re-run metadata extraction for all affected files.
Sadly, #2908 does not seem to fix this issue.

According to exiftool, the affected files feature a correct Modify Date, Track Modify Date, Media Create Date, Media Modify Date. Only the Create Date is invalid.

@pentix commented on GitHub (Sep 27, 2023): Same issue here! After upgrading to 1.79.1 I re-run metadata extraction for all affected files. Sadly, #2908 does not seem to fix this issue. According to exiftool, the affected files feature a correct `Modify Date`, `Track Modify Date`, `Media Create Date`, `Media Modify Date`. Only the `Create Date` is invalid.
Author
Owner

@alextran1502 commented on GitHub (Nov 1, 2023):

Should be fixed now

@alextran1502 commented on GitHub (Nov 1, 2023): Should be fixed now
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#1185