Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live photo #378

Closed
aymenel opened this issue Jun 15, 2019 · 14 comments
Closed

Live photo #378

aymenel opened this issue Jun 15, 2019 · 14 comments
Assignees
Labels
enhancement New feature or request Project for volunteers The team has no plans to work on it (e.g. lack of time) but an external contribution is accepted

Comments

@aymenel
Copy link

aymenel commented Jun 15, 2019

Сould you implement view live photo from Apple?

@ildyria
Copy link
Member

ildyria commented Jun 15, 2019

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

@kamil4
Copy link
Contributor

kamil4 commented Jun 15, 2019

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 😃. It would also be great if you could post sample files as well...

@aymenel
Copy link
Author

aymenel commented Jun 18, 2019

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
Copy link
Member

ildyria commented Jun 18, 2019

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
Copy link
Member

ildyria commented Jun 18, 2019

Related : #206

@d7415
Copy link
Contributor

d7415 commented Jun 18, 2019

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
Copy link
Author

aymenel commented Jun 18, 2019

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
Copy link
Contributor

kamil4 commented Jun 19, 2019

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
Copy link
Author

aymenel commented Jun 19, 2019

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
Copy link
Contributor

d7415 commented Jun 19, 2019

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
Copy link
Contributor

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 kamil4 transferred this issue from LycheeOrg/Lychee-v3 Oct 23, 2019
@kamil4
Copy link
Contributor

kamil4 commented Oct 23, 2019

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 #363 (comment).

@kamil4 kamil4 added enhancement New feature or request JS - Lychee-Front Project for volunteers The team has no plans to work on it (e.g. lack of time) but an external contribution is accepted labels Oct 23, 2019
@tmp-hallenser
Copy link
Contributor

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:

  • Apple Live Photos: Upload jpg and mov after each other
  • Google Motion Photos: Normal upload of jpg, video is part of jpg file

Notes:

  • High resolution video might challenge the browser
  • Package for viewing only supports mov files, hence the current version converts the mp4 file from a Google Motion Photo to mov while keeping codecs, resolution etc. (should be very fast)
  • we need exiftool to extract the relevant exif information
  • it’s just a first version with likely some room for improvements and bugfixes

File samples:

  • Google Motion Photo:
  1. Google Photos Support joemck/ExtractMotionPhotos#1 (comment)
  2. https://photos.google.com/share/AF1QipO2_gTkgT1QwgYaWCTowaN6d2Cb5rvyJU10cjAdSU9Ao8v9Ec-r1v1cKdWEx6PNqg/photo/AF1QipP3IopzoNWtRutf8O0b0V_Tm83GIg_MdgnEWVMA?key=WEdYT3BMNFZGdUlwQ0l6aEdFT1UwVlg2LUZESDhn
  • Apple Live Photo:
  1. https://developer.apple.com/live-photos/assets/boy.jpg and https://developer.apple.com/live-photos/assets/boy.mov
  2. https://developer.apple.com/live-photos/assets/girl.jpg and https://developer.apple.com/live-photos/assets/girl.mov

@tmp-hallenser
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Project for volunteers The team has no plans to work on it (e.g. lack of time) but an external contribution is accepted
Projects
None yet
Development

No branches or pull requests

5 participants