Lychee icon indicating copy to clipboard operation
Lychee copied to clipboard

[Enhancement] Support new Google motion photos Android 11

Open alex-phillips opened this issue 5 years ago • 3 comments

With Android 11, motion photos are captured and saved differently. Previously, Google motion photos would have metadata specifying there was a 'micro video' embedded as well as the offset (which I believe was the bit offset to split the file on).

  "XMP:MicroVideo": 1,
  "XMP:MicroVideoOffset": 3711617,
  "XMP:MicroVideoPresentationTimestampUs": 1087885,
  "XMP:MicroVideoVersion": 1,

This is no longer the case. The following metadata exists instead:

  "XMP:MotionPhoto": 1,
  "XMP:MotionPhotoVersion": 1,
  "XMP:MotionPhotoPresentationTimestampUs": 466480,

I'm not sure the best way to split out the file now as it no longer gives the offset. I found another script that actually reads the data of the file and splits it when it detects a video header in the file. It seems to work with the older style as well as the newer style, but again, not sure if this is the best solution: https://github.com/ViRb3/google-camera-motion-photo-splitter

alex-phillips avatar Oct 09 '20 16:10 alex-phillips

A stackoverflow on the subject regarding the mp4 header detection: https://stackoverflow.com/questions/53104989/how-to-extract-the-photo-video-component-of-a-mvimg

alex-phillips avatar Oct 09 '20 16:10 alex-phillips

All we would need is the offset.

Here are my ideas how one could implement it:

  1. Write a php function to which checks if XMP:MotionPhoto is set, determines and returns the offset of the video
  2. Add the call here (https://github.com/LycheeOrg/php-exif/blob/c8c88a385be0de9af051d6cbbe6dc74ba4b2619b/lib/PHPExif/Adapter/Exiftool.php#L159) and write the offset to XMP-GCamera:MicroVideoOffset of the array

tmp-hallenser avatar Oct 10 '20 09:10 tmp-hallenser

HOw to play the Video With help of the below tags

"XMP:MotionPhoto": 1, "XMP:MotionPhotoVersion": 1, "XMP:MotionPhotoPresentationTimestampUs": 466480,

viveksamele08 avatar Jun 30 '21 06:06 viveksamele08