f2calv / CasCap.Apis.GooglePhotos

*unofficial* Google Photos REST API library for .NET projects.
MIT License
58 stars 10 forks source link

How to upload a "live" photo? #129

Closed rgelb closed 1 year ago

rgelb commented 1 year ago

"Live Photo" is an iPhone construct where the camera records 2 seconds of video and using some algorithm picks the best frame and that is what displays on phone's Photos app. When you long tap the photo, the entire 2 second video plays.

When Google Photos app backs up this "Live Photo", it shows up as a photo on the website, however, it has a "Turn on motion" button, that allows you to play the entire video, just like on the phone.

image

I have this "Live Photo" file on my desktop and Google Photos exports it as an mp4. However, when I upload the photo using _googlePhotosSvc.UploadMediaAsync and _googlePhotosSvc.AddMediaItemAsync combo, it just shows up as another video.

Is there a way to tell Google Photos that it's a "Live Photo"?

f2calv commented 1 year ago

I'm an android user so I can't test this, but did you try downloading a 'live photo' via the API? Via the API what is the content-type of the downloaded file? Maybe you can post a (redacted) MediaItem JSON output?

rgelb commented 1 year ago

@f2calv I'll try downloading tomorrow. But I got the file down to my system via the Google Takeout mechanism. Will let you know.

rgelb commented 1 year ago

@f2calv So I fetched everything in the account via GetMediaItemsAsync method, per your suggestion. It returned a single entry for the "live photo" - an .HEIC file (image/heif). Here is the MediaItem object serialized as json.

Looking at the data returned, there is no evidence that this photo is a "live photo". Even though on the website, it shows the "Turn on motion" button.
image

If you get all your photos via Google Takeout, it downloads 2 separate files (IMG_3194.HEIC and IMG_3194.MP4). Via the API there is no MP4 at all. I suspect that the Google Photos API is simply limited and there is nothing that can be done. But I thought I'd ask.