FossifyOrg / Gallery

Browse your memories without any interruptions with this photo and video gallery
https://www.fossify.org
GNU General Public License v3.0
1.35k stars 41 forks source link

Add Motion Photo / Live Image Support #59

Open Naomitr0n opened 6 months ago

Naomitr0n commented 6 months ago

Checklist

Is your feature request related to a problem? Please describe.

Motion photos / live images aren't supported. See also Simple Gallery Issue 1426

Describe the solution you'd like

When a motion photo is shown in the image view (not the folder view), show the stationary image for a half second, then show the video, then back to the image. This is how the stock LG Gallery app works (I can take a screen recording video of this behavior if it would be helpful)

Describe alternatives you've considered

Aves supports this feature (and is also FOSS), but the interface is very, very different than the stock gallery app. I am not aware of any other non-OEM apps that support motion photos, even paid ones. I believe Aves to be the only Android app so far, which is tested and confirmed working correctly on the images I've attached to this issue ticket, which is useful for both testing purposes and having a frame of reference for how a different app is doing it.

Additional context

There's a very detailed and helpful comment on the Simple Gallery issue that seems promising. For videos embedded in the JPG itself, it's best to search through the file for a predefined character code (EXIF data isn't always available nor helpful from what I gathered). LG V60 motion photos like the two I've attached have ftypmp4 plainly visible in a hex editor. I believe there are a few open source tools for Windows made specifically to extract the MP4 from these motion photos, though I haven't used them to confirm if they work.

Given the edit functionality to this app, I strongly encourage some kind of message to the user telling them how live images are handled and letting them choose how to proceed. I've been known to resize my live photos to 100% just to remove the video portion from time to time, but perhaps it's possible to change the orientation/size of videos along with the image? How edits are handled are probably better in a discussion or different issue ticket, I imagine a good "for now" fix is to just warn the user that any edits will remove the video part of the motion photo, and allow them to save edits to a new image instead of an overwrite, then let them decide what to do.

I've also attached a couple motion images that I took specifically to help test any implementations out. If displayed correctly, you get the context leading up to the captured image. There's a purple mat the camera is on at the beginning of the video in the first one of Cleo yawning, and in the second one of her brother biting my finger, she's in focus looking at him before he lifts his head up when the video part starts. Cat tax and all :)

1010231121 0402231724c

Aga-C commented 6 months ago

Could you upload examples to some file hosting? I think that GitHub converted them to normal JPGs.

Is the FAQ the same one as the last checklist item? Not clear on that, but if it is then yes I have, otherwise please guide me to it

The FAQ is inside each app (three dots -> About -> FAQ).

Naomitr0n commented 6 months ago

Those are indeed the same JPG images :) Github renamed then, but I downloaded both just now from this page and they still show the motion preview correctly in the stock LG gallery app as well as Aves. Should be around 9-10 MB each.

Ah, didn't realize the FAQ was in-app. Only appears in the menu on the main screen, not in sub-folders -- don't know if that's a bug or intended behavior. That's super useful actually thanks!

Naomitr0n commented 6 months ago

Attaching a ZIP of both pics in case some GitHub viewer app or API does some processing on the pics: Motion Photos.zip

natrius commented 5 months ago

Same for Xiaomi with MIUI, the pictures get called MVIMG instead of IMG in front and sometimes i happen to change it to that by mistake. Would be nice to see the short video in that case :) Thanks for forking!

slipperybeluga commented 1 month ago

Photoprism, an opensource desktop image photo application that has motion photo support, has some good information in their Github issues from when they were adding this support that may be useful to whomever tackles this.

Includes all the details about how Google, Samsung, and Apple motion photos / live photos are recognized and handled in that app. Includes samples of each as well. Pull request for the google motion photos is well documented on how this was implemented.

https://github.com/photoprism/photoprism/issues/1739 https://github.com/photoprism/photoprism/pull/3709 https://github.com/photoprism/photoprism/issues/177 https://github.com/photoprism/photoprism/issues/439