immich-go icon indicating copy to clipboard operation
immich-go copied to clipboard

Add motional part of live photo into album incorrectly.

Open wuzihao051119 opened this issue 10 months ago • 9 comments

When adding live photos into album, immich-go uses API POST /api/album PUT /api/album/:id

The guids of motional parts of live photos should not be added into the request body.

Also, immich should check whether the video is motional part of live photo.

See post. See details.

@owpac Your issue is not same as the others, although they have the same presentation. The cause is here.

wuzihao051119 avatar May 03 '25 07:05 wuzihao051119

How to know the the file is the motion part of a live video?

MP4 metadata are known to hard to read, and at this point I don't want to add a dependency to exiftool

simulot avatar May 03 '25 08:05 simulot

So I think solving this issue in immich server is more appropriate. What's your opinion?

wuzihao051119 avatar May 03 '25 08:05 wuzihao051119

I'd prefer. Immich has already the logic to link the couple photo / movie of live photo. Can you use it?

Immich-go filter's out movie part of Android Motion Picture. The task is based on the file name (MVIMG or MP files)

simulot avatar May 03 '25 09:05 simulot

By the way, I'm about to release a version of immich-go that pause all background job during upload, and resume them.

This obviously remove the cause of the race conditions. But an interesting side effect is to speed up the upload, and defer the background work...

Does it worth to publish it now?

simulot avatar May 03 '25 09:05 simulot

Linking live photos only happens on metadata extraction. The album api will not filter motional parts. In immich-go, after uploading assets, the server will linking automatically in metadata extraction. What we need to do is preventing motional parts from being added to the album in database. So the logic cannot be reused.

If you add assets to album before matedata extraction, the motional part will be removed from album automatically.

wuzihao051119 avatar May 03 '25 09:05 wuzihao051119

Pausing all background job is necessary. The database is a mess because of the cause of race condition. So I think it is worth to publish.

wuzihao051119 avatar May 03 '25 09:05 wuzihao051119

So I think it is worth to publish.

Will do

What we need to do is preventing motional parts from being added to the album in database. So the logic cannot be reused.

I can re-implement a logic based on file name and date of capture. Each couple of file with same date time of capture and same base name, but 1 photo and one move are considered as a live picture.

The updateAsset endpoint references a field named livePhotoVideoId. What's its purpose?

If you add assets to album before matedata extraction, the motional part will be removed from album automatically.

This will be the case when jobs are suspended.

simulot avatar May 03 '25 09:05 simulot

I can re-implement a logic in immich server to prevent something rare such as modified file name or date from happening. It is very important.

The updateAsset endpoint references a field named livePhotoVideoId. What's its purpose?

Its purpose is backup in mobile app. In mobile app, we know which photo is live, so we upload motional part first, then static part with livePhotoVideoId. livePhotoVideoId will be used in linking in metadata extraction.

But in immich-go, we don't know which photo is live. So we should re-implement logic in immich server.

wuzihao051119 avatar May 03 '25 10:05 wuzihao051119

Hello!

Thanks @wuzihao051119 to open an issue following my post. I wasn't sure if it was coming from Immich directly or not, but I should have open it here anyway just to be sure.

Tbh, I'm not sure to get the whole picture of the issue: if I understand correctly, it's a race issue on Immich side, but depending on how immich-go use the api it may avoid to trigger it?

Anyway, if you think the new immich-go version can correct the issue, I can try to erase my Immich server and try to import back my pictures to test it if you want?

owpac avatar May 03 '25 18:05 owpac