arter97 / immich-native

Immich hosted without Docker
51 stars 6 forks source link

HEIF support missing #9

Open Arvoreen opened 2 months ago

Arvoreen commented 2 months ago

So I set up initially on Debian Bookworm. This version has an older 'libvips' installation, and when sharps gets installed, it uses its prebuilt binaries, which do not include support for HEIF. I managed to solve this myself by upgrading to trixie, then modifying the install.sh script to add '--build-from-source' to the npm install command line for sharp.

I suppose other option would be to manually update or install libvips on Bookworm, then use the same change to the install command above.

This is not really a 'bug report' per-se, but more of a note for anyone else that runs into this problem.

The symptom of this is errors like this in the microservices log file (and missing thumbnails for any photos from an iPhone)

[Nest] 14529  - 06/06/2024, 1:38:52 PM   ERROR [ImmichMicroservices] [JobService] Unable to run job handler (thumbnailGeneration/generate-preview): Error: Input file contains unsupported image format
[Nest] 14529  - 06/06/2024, 1:38:52 PM   ERROR [ImmichMicroservices] [JobService] Error: Input file contains unsupported image format
    at Sharp.toFile (/data/app/node_modules/sharp/lib/output.js:89:19)
    at MediaRepository.generateThumbnail (/data/app/dist/repositories/media.repository.js:69:14)
    at MediaService.generateThumbnail (/data/app/dist/services/media.service.js:158:48)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async MediaService.handleGeneratePreview (/data/app/dist/services/media.service.js:135:29)
    at async /data/app/dist/services/job.service.js:145:36
    at async Worker.processJob (/data/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
    at async Worker.retryIfFailed (/data/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
[Nest] 14529  - 06/06/2024, 1:38:52 PM   ERROR [ImmichMicroservices] [JobService] Object:
{
  "id": "09c08053-2f1c-4650-ae49-7554bf2deaaa"
}
arter97 commented 2 months ago

Thanks for the note.

Is "sharp" the only dependency needed for HEIF? The upstream Docker's base image also builds ImageMagick on its own, I figured it's needed for HEIF or RAW support.

Also, if Trixie's libvips supports HEIF, why is "--build-from-source" needed? Shouldn't it automatically pick up libvips support and use it?

Thanks.

LazyFunker commented 2 months ago

I have the same problem. But I can't seem to be able to fix it. I've tried both on trixie and ubuntu 22.04, building my own version of libvips with heif support. Do you have any pointers of how I can fix this?

4v3ngR commented 2 months ago

It appears that the sharp package request libvips to be installed globally (https://www.libvips.org/).

relax-a-bit commented 2 months ago

I have installed the libvips according to https://github.com/immich-app/base-images/blob/main/server/bin/build-libvips.sh but immich still lacks support for heif. Do I have to rebuild the installation?

TransRapid commented 1 month ago

He says he does not include it for copyright reasons.

TransRapid commented 1 month ago

Install libde265 lbx265, then libheif, then webm, then libvips, then in your script

npm install sharp --build-from-source --verbose --foreground-scripts.