immich-app / immich

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

[BUG] iOS live photos which have been rotateed or an effect are shown as separate images and videos in immich #5473

Closed philw07 closed 10 months ago

philw07 commented 11 months ago

The bug

When uploading a live photo from iOS which has either been rotated or an effect (bounce, loop, etc.), it will be displayed as separate photo and video in immich. In case of rotated photos, the video has the original orientation. I would expect it to show as a regular live photo in immich (without any effect, but ideally rotated correctly).

The OS that Immich Server is running on

Debian

Version of Immich Server

v1.89.0

Version of Immich Mobile App

v1.89.0

Platform with the issue

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: ["start.sh", "immich"]
    volumes:
      - photos:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    restart: unless-stopped
    networks:
      - default
      - web
    labels:
      <traefik labels>

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: ["start.sh", "microservices"]
    volumes:
      - photos:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
      - typesense
    restart: unless-stopped

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: unless-stopped

  typesense:
    container_name: immich_typesense
    image: typesense/typesense:0.24.1@sha256:9bcff2b829f12074426ca044b56160ca9d777a0c488303469143dd9f8259d4dd
    environment:
      - TYPESENSE_API_KEY=${TYPESENSE_API_KEY}
      - TYPESENSE_DATA_DIR=/data
      # remove this to get debug messages
      - GLOG_minloglevel=1
    volumes:
      - tsdata:/data
    restart: unless-stopped

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:80cc8518800438c684a53ed829c621c94afd1087aaeb59b0d4343ed3e7bcf6c5
    restart: unless-stopped

  database:
    container_name: immich_postgres
    image: postgres:14-alpine@sha256:50d9be76e9a90da4c781554955e0ffc79d9d5c4226838e64b36aacc97cbc35ad
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: unless-stopped

networks:
  web:
    external: true

volumes:
  pgdata:
  model-cache:
  tsdata:
  photos:
    <nfs share options>

Your .env content

IMMICH_VERSION=release

TYPESENSE_API_KEY=<pw>
DB_PASSWORD=<pw>

DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

REDIS_HOSTNAME=immich_redis

Reproduction steps

1. Take a live photo on iOS device
2. Rotate it or add an effect (bounce, lopp, etc.)
3. Upload the photo to immich
4. Immich will show a separate photo and video

Additional information

No response

shenlong-tanwen commented 11 months ago

@philw07 Can you please check if the live photo is linked properly in the web version? And, if it does, can you swipe down twice in the main timeline of the mobile app to trigger a force refresh of the asset state and check if that fixes your issue?

philw07 commented 11 months ago

@shenlong-tanwen It’s also not linked in the web interface.

shenlong-tanwen commented 11 months ago

@shenlong-tanwen It’s also not linked in the web interface.

Odd. Does this happen only for live photo with edits? Also, is it possible to share such live photo as a file to reproduce the issue?

You can also check the following things:

philw07 commented 11 months ago

Does this happen only for live photo with edits?

Yes, I've uploaded dozens of live photos and only edited ones are displayed separately.

Also, is it possible to share such live photo as a file to reproduce the issue?

Sorry, I can't share any at the moment, but if you have access to an iOS device it's literally as easy as taking a live photo and rotating it via Edit → Crop → Rotate → Save.

Ensure that the Meta data extraction job is running and refresh the metadata manually for the still and motion part of the live photo from the web app

I think it ran, as the non-edited live photos are recognized as such and also other metadata like location and camera are available. Re-running it manually for an affected photo and video had no effect.

Check if both the photo and motion part of the live photo has the livePhotoCID EXIF tag set and to be equal for both the assets.

Where can I check this? I didn't find anything in the immich UI and am unable to check the photo/video files at the moment.

I found a similar issue in #4209 with the livePhotoCID keyword, so I am leaving the link here just in case.

mike12806 commented 11 months ago

I'm seeing the same issue but without editing the photo, I'm still getting a video and the photo uploaded. Not sure if it's silently editing the file in the background, but I also have the nextcloud app uploading photos too....

For me, it's fine in the web interface (they are linked)....

Metadata extraction job seems to be running just fine.

shenlong-tanwen commented 11 months ago

For me, it's fine in the web interface (they are linked)....

If they are linked in the web app, Kindly swipe twice in the main timeline of the mobile app to trigger a full sync of assets which would link them in the mobile app as well. Your issue where the asset is linked in the web-app and not in the mobile app would be fixed in the next release.

philw07 commented 11 months ago

So after some reading, I took a live photo and uploaded it to immich and checked the exif using exiftool afterwards. The image was correctly displayed as a live photo in immich and both the HEIC image and MOV video had the same identifier.

$ exiftool -a -u -g1 IMG_4331.HEIC | grep UUID
Media Group UUID                : 0B62DBD0-DF75-4CBC-8F33-EDEAD7F3E5DF

$ exiftool -a -u -g1 IMG_4331.MOV | grep Identifier
Content Identifier              : 0B62DBD0-DF75-4CBC-8F33-EDEAD7F3E5DF

Afterwards, I deleted the photo and rotated it in iOS, then uploaded it again. This time, it was displayed as separate photo and video in immich. I checked the exif data again and indeed the identifier of the image was changed, but the identifier of the video stayed the same.

$ exiftool -a -u -g1 IMG_4331.HEIC | grep UUID
Media Group UUID                : 8CC62E05-CA31-49F8-A114-C3FFD2FEBD6F

$ exiftool -a -u -g1 IMG_4331.MOV | grep Identifier
Content Identifier              : 0B62DBD0-DF75-4CBC-8F33-EDEAD7F3E5DF

This seems to explain why immich can't link them. Unfortunately, I could neither find the new ID in the video metadata, nor the old one in the image metadata. Hence I'm not sure if it's possible to link them after the image has been edited.

mike12806 commented 11 months ago

I'm seeing this without having edited the photo. Re-running metadata extraction fixes it.

ChristopherFunk commented 11 months ago

I'm seeing this without editing the photos, and re-running metadata extraction does not fix it for me

shenlong-tanwen commented 11 months ago

I'm seeing this without editing the photos, and re-running metadata extraction does not fix it for me

Are your assets not linked in the web app as well? If so, Can you share the original photo and video asset that are supposed to be linked together? If they have sensitive or personal info, Can you try reproducing it with a new Live photo and share it with us for troubleshooting?

ChristopherFunk commented 11 months ago

Hello, yes it is happening in web, I have older photos where this happens too, starting December 1st (which is weird I don't think it happened around a release). Also confirming I went to the web and under admin re-ran EXTRACT METADATA on ALL photos

This is from today

and here they are downloaded from immich web:

and the original photo:

This is coming from an iPhone 14 Pro, and I just checked the app version is up to date, v1.89.0, server on same version

Let me know if you need anything else, happy to help!

shenlong-tanwen commented 11 months ago

@philw07 / @ChristopherFunk Both of your issues should be fixed in the next version of the app. We'll keep this issue open until the next release.

philw07 commented 11 months ago

Fantastic, thanks so much. I will check when the update is available.

ChristopherFunk commented 11 months ago

Woohoo! Thanks so much! I'm assuming we'll need to do another metadata refresh to fix existing photos?

shenlong-tanwen commented 11 months ago

Woohoo! Thanks so much! I'm assuming we'll need to do another metadata refresh to fix existing photos?

Sadly, The live photos has to be removed and re-uploaded again for them to be properly linked. This shouldn't hopefully be required again in the future. Apologies for the trouble caused. We'll get this added to the release notes as well, asking users to re-upload their unlinked live photos from the iOS app.

smndtrl commented 11 months ago

@shenlong-tanwen In which commit was this fixed? I'm curious how this was solved. I might have a few hundred of those images where the tag in EXIF does not match and there are no "originals" available on the phone anymore.

philw07 commented 11 months ago

I updated my server and app and re-uploaded several live photos as well as taking and editing some new photos. Everything seems to be linked correctly, so from my point of view this ticket can be closed. I’m keeping it open for @ChristopherFunk to confirm it’s working on his side.

@shenlong-tanwen Thanks again.

@smndtrl I think that would be #5602.

smndtrl commented 11 months ago

Interesting. I'm wondering if that change lead to the other issue I'm seeing. A live photo (bounce effect) export is correctly matched, yet the file metadata and quality is hugely affected. See the second image with resolution, filesize and missing metadata like GPS.

My app version is 1.91.2 and the server runs on 1.90.2

The following image shows IMG_6086 (1), which is the export from Apple Photos vs IMG_6086, the download from the immich server. image

The live photo is matched fine since the update. image

If switching off the live photo effect, the same photo is displayed like this. image With more similar file sizes to the Apple Photos export. image

@philw07 Did you notice something similar for recent live photos with effects? If not, I'm going to have to open up a new issue to figure this out.

alextran1502 commented 11 months ago

@smndtrl hello, do you know if those LivePhotos get edited anyway after being taken?

smndtrl commented 11 months ago

The only thing I did was to

  1. switch from Live to Bounce
  2. Then sync from iOS to the server
  3. Download them (small HEIC)
  4. Switch from Bounce to Live
  5. Delete image from server
  6. Sync again from iOS

All looks good on the server

No cropping, painting, rotating or anything else. I didn't even use the Edit menu but the quick switcher.

philw07 commented 11 months ago

I didn’t notice it before, but I can confirm it also happens on my side.

WolfgangDpunkt commented 11 months ago

How can we identify photos that need to be deleted and re-uploaded? I uploaded thousands of iOS-photos during this specific period. I have them backed up in iCloud, so it is not a big problem. However, I want to locate the photos that require deletion and re-upload to be properly linked. Is there a search string specifically for iOS photos? (Crosspost from Reddit, sorry, but I was not sure if it will be noticed there)

shenlong-tanwen commented 11 months ago

@shenlong-tanwen In which commit was this fixed? I'm curious how this was solved. I might have a few hundred of those images where the tag in EXIF does not match and there are no "originals" available on the phone anymore.

5601

There are two ways in which assets are linked together as live photos. i) both the video and photo asset are uploaded together in the same upload request 2) matching "Content Identifier" metadata

We thought of removing i) and use ii) for linking live photos always and released the mobile app changes as such. But looks like not all livePhoto's still and motion part have matching metadata, like from the few examples above, which resulted in them not getting linked together since we started relying on only the metadata. The fix was to actually revert it and go back to uploading both the assets together in the same request and the server would link them without going through the metadata. This was also why we requested the existing un-linked livephotos to be removed and re uploaded again.

shenlong-tanwen commented 11 months ago

@philw07 Did you notice something similar for recent live photos with effects? If not, I'm going to have to open up a new issue to figure this out.

Can you raise this as a separate issue?

shenlong-tanwen commented 11 months ago

How can we identify photos that need to be deleted and re-uploaded? I uploaded thousands of iOS-photos during this specific period.

You can check the comment by Christopher - https://github.com/immich-app/immich/issues/5473#issuecomment-1846533152

The still and motion photos are getting displayed as two different assets in the timeline, which means that the live photo is not properly linked

ChristopherFunk commented 10 months ago

I updated my server and app and re-uploaded several live photos as well as taking and editing some new photos. Everything seems to be linked correctly, so from my point of view this ticket can be closed. I’m keeping it open for @ChristopherFunk to confirm it’s working on his side.

@shenlong-tanwen Thanks again.

@smndtrl I think that would be #5602.

Hi sorry! It's all working on my end! Been uploading photo's like crazy and no issue on my end! 😄

Ahh I kept reading, I haven't tried any of these other effects in my photo's, but the simple snap and upload is working for me. Editing the photo by changing the Key Frame in a live photo doesn't break it for me either, but I haven't tried any of the other effects.

CarterMoody commented 6 months ago

Still an issue for me on 1.102.3 I have the exact same symptoms as this. This has not been fixed? :

Hello, yes it is happening in web, I have older photos where this happens too, starting December 1st (which is weird I don't think it happened around a release). Also confirming I went to the web and under admin re-ran EXTRACT METADATA on ALL photos

This is from today

  • Photos in the web, it's hard to tell but the right photo has the 0:01 Play button icon in it live photo split into 2 on web
  • Photo photo-from-live-photo
  • Video video-from-live-photo

and here they are downloaded from immich web:

and the original photo:

This is coming from an iPhone 14 Pro, and I just checked the app version is up to date, v1.89.0, server on same version

Let me know if you need anything else, happy to help!

alextran1502 commented 6 months ago

@CarterMoody if a LivePhotos is modified, it will lose the information that we need to link the two files together... and this is due to how Apple handles file editing, unfortunately

CarterMoody commented 6 months ago

@alextran1502 I have not modified any of these photos yet they still show up this way. I have run the metadata extraction job on my entire library and they still show up as both a still and a live photo separately. What do I need to do to fix this?

afonsofrancof commented 4 months ago

I also have this issue. I don't edit any of my live photos yet some are uploaded correctly and others are uploaded as video+photo. It's a bit annoying, and at the moment I have disabled live photos on my phone. Would be nice to have a way to manually link them

7122435 commented 3 months ago

Hello. Same problem here. On 1.109.2 version of Immich (iOS 17.5.1) Live Photos are not uploaded properly. Some photos taken with my iPhone are separated into two elements - a 1s long video and an image. The video is correctly synchronized with the server, but the image is not synchronized at all. This only happens with some Live Photos. The remaining Live Photos are synchronized correctly. None of them were edited on iPhone before syncing.