LycheeOrg / Lychee

A great looking and easy-to-use photo-management-system you can run on your server, to manage and share photos.
https://lycheeorg.github.io/
MIT License
3.42k stars 303 forks source link

Live photo #378

Closed aymenel closed 4 years ago

aymenel commented 5 years ago

Сould you implement view live photo from Apple?

ildyria commented 5 years ago

I'm sorry I don't understand your request.

kamil4 commented 5 years ago

From what I can gather, Apple live photos consist of two resources: a JPEG and a 3-second MOV file. Lychee supports both already so the question to the original poster is: is that not sufficient? What sort of support would be needed to give these live photos justice?

Sorry, I don't have an iPhone and I guess neither does @ildyria so you'll need to explain it to us in basic terms :smiley:. It would also be great if you could post sample files as well...

aymenel commented 5 years ago

Yes, individually these formats are already supported. But the format involves displaying only photos in the album, and the video is played when you click on the photo. See https://dlaa.me/Samples/live-photo-web/ implementation demo from the repository https://github.com/DavidAnson/live-photo-web

ildyria commented 5 years ago

This would implies changes in the front-end and backend (photo - video association). I will be honest I personally will not dedicate time to implement such things. If another member of the team (or someone else) wants to make a PR for it, then maybe it will be merged.

ildyria commented 5 years ago

Related : https://github.com/LycheeOrg/Lychee/issues/206

d7415 commented 5 years ago

the format involves displaying only photos in the album, and the video is played when you click on the photo.

Sounds (behaviour wise) like a video with a thumbnail.The question would be how to recognise that a user wants to treat that image as the thumbnail vs generating one. That would in turn allow users to pick a thumbnail for their videos though if they really want, rather than putting up with what Lychee extracts.

aymenel commented 5 years ago

I do not know how this format is presented in apple, but when exporting, you get two files with the same names MP4 and JPEG. How it looks on the phone can be seen here https://developer.apple.com/live-photos/

kamil4 commented 5 years ago

Probably the easiest way to implement this would be to provide a "coupling mechanism" that attaches an already uploaded image to an also already uploaded video. A single extra button in the photo view (that only shows for video files) would do, or multiselect and a new context menu entry (that only shows if one image and one video are selected). Until they are attached, they are two separate photo entities in Lychee. Afterwards, I guess the thumb we extracted gets replaced by the image and the separate photo entry is (optionally?) deleted?

A question to the original poster: would you expect the live photos to animate just in the photo view (like videos currently are) or should they also animate in the album view (the view where you see the whole contents of the album, i.e, multiple photos on the screen)?

Also, as @ildyria indicated, don't get your hopes up. We've got a lot of more urgent things to fix/implement first...

aymenel commented 5 years ago

IMHO button for combining is not the best solution, for example, I have already gathered several thousand of such photos. Better auto join. For example, according to the model of the camera from exif + the same names in photos and videos. Animation in the thumbnail view will be unnecessary.

d7415 commented 5 years ago

Better auto join. For example, according to the model of the camera from exif + the same names in photos and videos.

I see your point, but this feels "clunky". If we were going to auto-join, I'd suggest a setting that does this for all image/video pairs with matching filenames, regardless of metadata. I'd probably also limit it to the initial upload/import step - if there's a pair there, combine them but not if added later.

As indicated, this is not a priority for the core team but we would consider accepting a PR.

tmp-hallenser commented 5 years ago

That's an interesting idea to support Live Photos. I've spent some time researching and thought it's worth sharing my findings:

Formats: There are different formats by different vendors (next to Apple).

  1. iOS - Variant 1 (JPG + MOV) This version is the 'legacy' version of Live Photos (can still be set as default on current iOS) where a JPG and a MOV file is created. Both files have an identifier allow a join (see https://stackoverflow.com/a/47629868 ). The time of the photo in the video can be extracted from the video (https://stackoverflow.com/a/35286486)
  2. iOS - Variant 2 (HEIC) Apple recently moved to HEIC and HEIF format for photos and videos. For Live Photos, the video part ist also stored in the HEIC file. While it's possible to convert a HEIC photo to JPG using ImageMagick, extracting the video is more difficult. There is decoder by Nokia (https://github.com/nokiatech/heif), but we would need something like this for the server.
  3. Google Motion Photos Google stores the video within the JPG file. This article explains how to extract the video part: https://android.jlelse.eu/working-with-motion-photos-da0aa49b50c
  4. Samsung Motion Photo Samsung also stores the video within the JPG file. I found a code piecing doing the extraction using exiftool (https://gist.github.com/kmark/67cf6c03753ccab155a5da31b3ccd93e )

Display Live Photos: There are two npm packages for an easy display of Live Photos

  1. livephotoskit (https://www.npmjs.com/package/livephotoskit)
  2. laphs (https://www.npmjs.com/package/laphs)

Implementation idea (only first thoughts)

  1. Database Add cols LivePhotoURL (url of the video), LivePhotoStillImageTime (time of the still image within the video) and LivePhotoIdentifier (only for sequential upload of Apple Live Photos - used to identify a match of video and photo)
  2. Add support for exiftool In order to extract the required data (tested for Apple, untested for Google/Samsung), we need to make use exiftool (there is a composer package for it). Since exiftool is not available at all hosting providers, we should keep the current extractor implementation to ensure compatibility.
kamil4 commented 5 years ago

FYI, I moved this issue to the Lychee-Laravel repo so that it doesn't get lost...

Regarding the exiftool support, I just added some comments about it at https://github.com/LycheeOrg/Lychee-Laravel/issues/363#issuecomment-545507833.

tmp-hallenser commented 5 years ago

Hi,

I’ve just pushed a first version supporting Live Photos (Apple Live Photos and Google Motion Photos) to my repository (branches support-live-photo)

When installing it, you need to run npm install && npm run compile in the frontend and composer install in the backend to update files.

Upload:

Notes:

File samples:

tmp-hallenser commented 4 years ago

I'll close the issue since we have a first version of live photo implemented.