immich-app / immich

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

iOS 18 HEIC Images - Thumbnail Generation Fails #10464

Closed rlobbins closed 2 months ago

rlobbins commented 3 months ago

IMG_1190.zip

The bug

Since installing 1.106.4 and updating to the iOS 18 beta, any image taken by my phone that is uploaded from my iOS device fails to create thumbnails/web previews. Logs state the files have incorrect headers. Photos sent to me and saved/backed up from iOS 17 devices continue to function as normal. Only photos taken with iOS 18 seem to be affected.

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

V1.106.4

Version of Immich Mobile App

v1.106.3 build 160

Platform with the issue

Your docker-compose.yml content

version: "3.8"

#
# 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-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding
       file: hwaccel.transcoding.yml
       service: nvenc # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

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

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:afb290a0a0d0b2bd7537b62ebff1eb84d045c757c1c31ca2ca48c79536c0de82
    restart: always

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

volumes:
  pgdata:
  model-cache:

Your .env content

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

# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/array/apps/immich

# 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=

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

REDIS_HOSTNAME=immich_redis

Reproduction steps

1. Update device to iOS 18
2. Attempt to backup images taken after the update
3. Server fails to generate thumbnails

Relevant log output

[Nest] 17  - 06/18/2024, 5:41:47 PM VERBOSE [Api:LoggingInterceptor~idwlr3vh] {"assetIds":["34e9b298-7961-478c-8ac3-c3c121653674"],"name":"regenerate-thumbnail"}
[Nest] 7  - 06/18/2024, 5:41:47 PM   ERROR [Microservices:JobService] Unable to run job handler (thumbnailGeneration/generate-preview): Error: Input file has corrupt header: upload/library/admin/2024/2024-06-14/IMG_1190.HEIC: bad seek to 4809486
heif: Invalid input: Unspecified: Metadata not correctly assigned to image (2.0)
[Nest] 7  - 06/18/2024, 5:41:47 PM   ERROR [Microservices:JobService] Error: Input file has corrupt header: upload/library/admin/2024/2024-06-14/IMG_1190.HEIC: bad seek to 4809486
heif: Invalid input: Unspecified: Metadata not correctly assigned to image (2.0)
    at Sharp.toFile (/usr/src/app/node_modules/sharp/lib/output.js:89:19)
    at MediaRepository.generateThumbnail (/usr/src/app/dist/repositories/media.repository.js:69:14)
    at MediaService.generateThumbnail (/usr/src/app/dist/services/media.service.js:158:48)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async MediaService.handleGeneratePreview (/usr/src/app/dist/services/media.service.js:135:29)
    at async /usr/src/app/dist/services/job.service.js:148:36
    at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
    at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
[Nest] 7  - 06/18/2024, 5:41:47 PM   ERROR [Microservices:JobService] Object:
{
  "id": "34e9b298-7961-478c-8ac3-c3c121653674"
}

Additional information

No response

mertalev commented 3 months ago

There's an open libheif issue for this here. We can upgrade once they patch this.

othyn commented 3 months ago

Hopefully libheif support will arrive soon! As +1, I'm having the same issue.

Is it safe to continue uploading images in the meantime, then once libheif is updated and support rolled in, we can just run a 'missing thumbnails' job to backdate them all?

alextran1502 commented 3 months ago

@othyn yes, running missing thumbnail job will resolve the issue

othyn commented 3 months ago

Super, thank you for confirming!

samip5 commented 3 months ago

Oh, of course it's an IOS 18 thing... :DDDDD

This is what I get from using an beta.

coltography commented 3 months ago

There's an open libheif issue for this here. We can upgrade once they patch this.

It's showing as completed/closed now. Is it actually fixed and ready for update? I can't really tell based off the last comment they made on that issue.

mertalev commented 3 months ago

It's merged, but they haven't made a release since then.

tecnicx15 commented 3 months ago

For those wondering the new update 1.107 has not yet fixed the issue.

samip5 commented 3 months ago

For those wondering the new update 1.107 has not yet fixed the issue.

Of course not as the libheif hasn't yet cut a new release that Immich could pull.

SisyphusMD commented 2 months ago

Happy day. Looks like libheif v1.18.0 has been released with a fix.

pducharme commented 2 months ago

@SisyphusMD Do you know if it's included in the 1.108 build released just minutes ago ?

alextran1502 commented 2 months ago

No it doesn't. It hasn't been released on Debian repository yet afaik. We are monitoring to see how long it would take and will build it ourselves if it takes too long

pducharme commented 2 months ago

@alextran1502 Maybe you can answer my quesiton. When it will be added, we will only have to run a new "generate Thumbnails (Missing)" job to fix them all at once?

alextran1502 commented 2 months ago

@pducharme yes sir

9k001 commented 2 months ago

@pducharme yes sir

I sincerely hope that this problem will be repaired quickly. Because of this problem, I don't sync new photos now. Is this button on the web? I tried to click the Refresh thumbnails in the new version, but he didn't respond. At the same time, I found that the EXIF information of HEIC pictures was also missing

samip5 commented 2 months ago

No it doesn't. It hasn't been released on Debian repository yet afaik. We are monitoring to see how long it would take and will build it ourselves if it takes too long

To my understanding, Debian packages take extremely long to get packaged, or at least to a non unstable repo. I would highly recommend to not wait for it.

muammar commented 2 months ago

No it doesn't. It hasn't been released on Debian repository yet afaik. We are monitoring to see how long it would take and will build it ourselves if it takes too long

To my understanding, Debian packages take extremely long to get packaged, or at least to a non unstable repo. I would highly recommend to not wait for it.

I second this. I am a non-so-active-anymore Debian developer, and Debian does not update packages that fast unless you are using debian unstable or experimental for your docker images. Even those two debian branches are not updated to the cutting edge versions so fast. That's because of dependencies or because we are close to a Debian release.

mertalev commented 2 months ago

We were specifically waiting for Debian unstable to update libheif. But since libheif has a lot of dependencies through plugins, you might be right that it won't be that quick. We can just build it ourselves.

muammar commented 2 months ago

We were specifically waiting for Debian unstable to update libheif. But since libheif has a lot of dependencies through plugins, you might be right that it won't be that quick. We can just build it ourselves.

We could ask the multimedia team on the BTS to upload to experimental. I could not find any freeze happening soon: https://release.debian.org/trixie/freeze_policy.html

mertalev commented 2 months ago

We were specifically waiting for Debian unstable to update libheif. But since libheif has a lot of dependencies through plugins, you might be right that it won't be that quick. We can just build it ourselves.

We could ask the multimedia team on the BTS to upload to experimental. I could not find any freeze happening soon: release.debian.org/trixie/freeze_policy.html

Thanks for the suggestion! But I think it's simple to build it ourselves and may be better in the long run - libheif is a very imporant dependency that has to evolve with emerging standards etc. for these newer formats.

cur1ou5soul commented 2 months ago

Maybe I just got a blind spot, but, how can I update my base image via the docker-compose?

othyn commented 2 months ago

Maybe I just got a blind spot, but, how can I update my base image via the docker-compose?

There hasn't been another Immich container release yet, the 'base images' are just internally what they are built on top of. I think.

muammar commented 2 months ago

How could we know the timeline of new releases? It would be nice to see the HEIC images thumbnail generation fail fixed.

alextran1502 commented 2 months ago

Prepping for a release today

mertalev commented 2 months ago

We're looking to make a new release today.

Valpha commented 2 months ago

刚刚发现遇到了这个问题,于是来这里搜索答案,发现正好赶上热乎的 new release 开心!😆 感谢大佬! Thanks @alextran1502 @mertalev

rlobbins commented 2 months ago

Thanks for the urgency, sorry that it was due to a dependency upstream and not Immich. I just figured I should report it since I noticed it before iOS hit final public release in September, just to make sure it didn’t fall through the cracks. I was not expecting any fixes so quickly and appreciate the efforts of everyone involved.

othyn commented 2 months ago

Just a friendly ping to everyone watching this thread, v1.109.x is out with this patch.

rlobbins commented 2 months ago

Thanks, seems to work with a generate missing thumbnails command. Pretty disappointing to hear the licensing and direction the project is going towards though, before it has even hit stable status. Sad to see. All the best to you in the future.

pducharme commented 2 months ago

Thanks! the fix worked for me, after I regen the missing thumbnails. I also bought a Lifetime 99$ licence to support the project, thanks for the great work!