immich-app / immich

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

[BUG] Pixel Motion Photos only show a single frame #3421

Closed zsolt-donca closed 1 year ago

zsolt-donca commented 1 year ago

The bug

Motion photos that I took on my Pixel 7 don't seem to play well the newest release. When I click the video icon on the photo, it changes to the first frame of the video, but the video does not play (the same frames is stuck on the screen), even though it plays 2-3 seconds according to the controls at the bottom of the screen.

I experience the same behavior both in the web (Firefox) and on mobile.

The OS that Immich Server is running on

Arch

Version of Immich Server

1.69.0 build.92

Version of Immich Mobile App

1.69.0

Platform with the issue

Your docker-compose.yml content

Default

Your .env content

Default

Reproduction steps

1. Take a motion photo with Google Camera (using Pixel 7)
2. Open the photo in Immich on the mobile or on the web
3. Hit play, and notice that it does not play (even though the actual shot changes when compared to the photo)

Additional information

No response

zsolt-donca commented 1 year ago

Note that I have the following errors in my logs:

immich_postgres          | 2023-07-20 08:27:02.874 UTC [179] ERROR:  duplicate key value violates unique constraint "UQ_userid_checksum"
immich_postgres          | 2023-07-20 08:27:02.874 UTC [179] DETAIL:  Key ("ownerId", checksum)=(d30dd4c8-53c2-4f26-81f2-f7b743ac76e0, \xe541e7fba9ad80b99e4082b3b97b7b4f1ca312bc) already exists.
immich_postgres          | 2023-07-20 08:27:02.874 UTC [179] STATEMENT:  INSERT INTO "assets"("id", "deviceAssetId", "ownerId", "deviceId", "type", "originalPath", "resizePath", "webpPath", "thumbhash", "encodedVideoPath", "createdAt", "updatedAt", "fileCreatedAt", "fileModifiedAt", "isFavorite", "isArchived", "isReadOnly", "checksum", "duration", "isVisible", "livePhotoVideoId", "originalFileName", "sidecarPath") VALUES (DEFAULT, $1, $2, $3, $4, $5, $6, $7, $8, $9, DEFAULT, DEFAULT, $10, $11, $12, $13, $14, $15, $16, $17, DEFAULT, $18, $19) RETURNING "id", "webpPath", "encodedVideoPath", "createdAt", "updatedAt", "isFavorite", "isArchived", "isReadOnly", "isVisible"

Which makes my issue similar to https://github.com/immich-app/immich/issues/3411

UPDATE: these are probably unrelated, as these are not fresh errors. I've been seeing them since at least a month ago:

immich_postgres          | 2023-06-27 10:45:11.081 UTC [4677] ERROR:  duplicate key value violates unique constraint "UQ_userid_checksum"
immich_postgres          | 2023-06-27 10:45:11.081 UTC [4677] DETAIL:  Key ("ownerId", checksum)=(d30dd4c8-53c2-4f26-81f2-f7b743ac76e0, \x0c904c7b723fcb2ec7a3f29b77a9eec19d4c4e91) already exists.
immich_postgres          | 2023-06-27 10:45:11.081 UTC [4677] STATEMENT:  INSERT INTO "assets"("id", "deviceAssetId", "ownerId", "deviceId", "type", "originalPath", "resizePath", "webpPath", "thumbhash", "encodedVideoPath", "createdAt", "updatedAt", "fileCreatedAt", "fileModifiedAt", "isFavorite", "isArchived", "isReadOnly", "mimeType", "checksum", "duration", "isVisible", "livePhotoVideoId", "originalFileName", "sidecarPath") VALUES (DEFAULT, $1, $2, $3, $4, $5, $6, $7, $8, $9, DEFAULT, DEFAULT, $10, $11, $12, $13, $14, $15, $16, $17, $18, DEFAULT, $19, $20) RETURNING "id", "webpPath", "encodedVideoPath", "createdAt", "updatedAt", "isFavorite", "isArchived", "isReadOnly", "isVisible"
alextran1502 commented 1 year ago

Can you post a sample file for troubleshooting?

zsolt-donca commented 1 year ago

Sure: PXL_20230725_143859434 MP

zsolt-donca commented 1 year ago

If it helps, I can create a recording of my mobile screen where I open the above photo, both with Immich and with Google Photos.

alextran1502 commented 1 year ago

Yes please

zsolt-donca commented 1 year ago

Video with google photos: https://cloud.cozycozy.space/s/ggjd5Hr5DdKYmLx Video with Immich: https://cloud.cozycozy.space/s/KQCsQxW52ciDtyC

Inrego commented 1 year ago

I experience the same. If I can contribute with any other information, let me know.

jrasm91 commented 1 year ago

I think I've found the root issue - ffmpeg by default picks only one video stream the default picking mechanism uses highest resolution^1. The google motion pictures actually have two video streams. The first one is the one we want. But, it has a second one that has a higher resolution, so it is getting picked. The second video stream is very, very short.

zsolt-donca commented 1 year ago

The fix does not work for me. I am on version 1.76.1, and with the exception of a single motion-picture that I took, on the mobile all of my motion pictures show a very similar behavior as originally reported here: I only see a single frame, but it shows for longer. That single exception seems to play well on mobile for some reason, but it's like 1 out of 10, and I cannot reproduce it.

On the web, none of the videos play, including the one that works on mobile. When in full screen on an image, the behavior is actually browser-dependent: in Firefox I see a gray screen with the error message "No video with supported format and MIME type found":

image

while in Chrome, the video loader will just keep spinning forever:

image

Still on the web, on both browsers, when hovering over the little "Play" icon with the mouse, the icon changes into a red circle with an exclamation, which happens for motion pictures videos:

image

Should I open a separate bug for this issue? What details would you need for investigating?

jrasm91 commented 1 year ago

Can you delete and re-upload the video and see if that changes anything?

zsolt-donca commented 1 year ago

I just did that: deleted some of the motion photos on the web, and waited for the mobile app to re-upload them. I actually repeated the procedure twice. No change, exactly the same behavior as before.

jrasm91 commented 1 year ago

OK. The cause of the original issue is related to video stream selection, but it looks like the linked PR didn't actually fix it. I'll take a look at this again.

zsolt-donca commented 1 year ago

Thank you! Would my recent photos help investigating the issue, including the one that does work for some reason, and some of the new ones that don't?

jrasm91 commented 1 year ago

I can let you know. I have one that also doesn't seem to work.

mertalev commented 1 year ago

OK. The cause of the original issue is related to video stream selection, but it looks like the linked PR didn't actually fix it. I'll take a look at this again.

It looks like the option in the PR doesn't do what I thought it did. Selecting a stream like -c:v:0 tells it to encode that particular stream, not to output that particular stream. The map flag is the way to go after all.

mertalev commented 1 year ago

Should be fixed with #3775

zsolt-donca commented 1 year ago

Thank you, @mertalev, for taking care of this!

After the fix lands in a release, is there a way way for me to reprocess the motion pictures that I already have uploaded in my library, so that their video will play?

mertalev commented 1 year ago

You can re-process them by running the transcode job for all videos. There's no way to process only motion pictures, so this will also transcode normal videos too.

Rihcus commented 1 year ago

Sure: PXL_20230725_143859434 MP

Are motion photos working for you on server version v1.79.1? I tried taking the motion photo you uploaded and tried putting on the immich demo server. The option to view the motion part of the motion photos doesn't seem to be present. Similarly mobile apps don't seem to be able to detect motion photo.

image

Demo server version: image

https://demo.immich.app/

zsolt-donca commented 1 year ago

This feature indeed got broken in some recent release. It definitely worked after installing the release that came out just after @mertalev 's latest fix (mentioned above), but now it no longer works (new motion photos don't get recognized as such, even though my old motion photos already in the library still work).

Can we please have this reopened?

alextran1502 commented 1 year ago

@zsolt-donca The regression has been fixed but not released yet

FarisZR commented 2 months ago

the issue seems to be back again... Edit: switching to h264 fixed it.