Skip to content

Live Photos: Add support for Google Camera Motion Photos #1739

Closed

Description

@Fylax

Similar to how you implemented the Apple Live Photo (#177) and to the currently developing #439.

Google Camera has its way of creating Motion Photos: it makes a JPEG and then the MP4 inside the same file.

The "Motion Photo" is identified by:

XMP:MicroVideo: 1 <- Before Android 11
XMP:MotionPhoto: 1 <- After Android 11

Extracting the video is straightforward and doable in a few bash commands:

srcfile=image
offset=$(grep -F --byte-offset --only-matching --text ftyp "$srcfile")
offset=${offset%:*}
dd if=$srcfile of=$srcfile.mp4 bs=$((offset-4)) skip=1

Note: I tested it only with Android 12 Motion Pictures. Moreover, versions <11 had the offset defined in an XMP.

Activity

  1. added
    ideaFeedback wanted / feature request
    on Nov 18, 2021
  2. changed the title [-]Support for Google Camera Motion Photos[/-] [+]File Type: Support for Google Camera Motion Photos[/+] on Nov 19, 2021
  3. hmueller01 commented on Jan 4, 2022

    @hmueller01

    A quick note.

    offset=$(grep -F --byte-offset --only-matching --text ftyp "$srcfile")

    This works only with GNU grep. BSD grep (macOS default) returns no match!
    Took me some time to figure out ... hope this helps others.

    More infos about Android 12 Motion Photos from Alan Orth's blog.

  4. wechsler42 commented on Mar 8, 2022

    @wechsler42

    According to Alan Orth's blog it seems that ..."As of Android 12 it appears that the MP4 header in Motion Photos has changed from ftypmp4 to ftypisom".. the header has changed which indicates the embedded video. See also the probably similar issue and the solution for GoMoPho.

  5. tribut commented on Jul 14, 2022

    @tribut

    When "HEIF pictures" is enabled, Samsung Camera appears to use this format also ("XMP:MotionPhoto: 1"), as opposed to their custom format described in #439.

  6. tribut commented on Aug 16, 2022

    @tribut

    Here is a sample .heic with embedded motion photo from a Samsung phone that uses this method, in case you need something to test:

    samsung-motion-heic.zip

  7. alex-phillips commented on Sep 7, 2022

    @alex-phillips

    Just to add some information I found here, while older images had the offset in XMP under MicroVideoOffset, it seems newer versions have defined this offset in a separate Directory Length value. See this comment on Nextcloud photos here: nextcloud/photos#365 (comment)

    Do note: there are 2 entries of that metadata key and the second one needs to be used.

    Also, some good info here on the "old" vs "new" formats and the hex values you can match against in the file: https://linuxreviews.org/Google_Pixel_%22Motion_Photo%22

  8. sethgillett commented on Dec 26, 2022

    @sethgillett

    Just a note for anyone having issues with the grep command not returning a byte offset on macos, prefixing the command with LC_CTYPE=C seems to fix the issue.

  9. grahamjpark commented on May 9, 2023

    @grahamjpark

    I'm new to PhotoPrism. I had just read this thread last week and then saw a new blog from ente on the topic come out today. Dropping here for future reference.

    https://ente.io/blog/tech/android-motion-photos-flutter/

  10. mholt commented on May 10, 2023

    @mholt

    ^ That's basically what I do in Timelinize. Works pretty well, and the information in that article looks accurate by my recollection.

  11. moved this to Upcoming ⏳ in Roadmap 🚀✨on Jun 8, 2023
  12. self-assigned this
    on Sep 6, 2023
  13. moved this from Upcoming ⏳ to Development 🐝 in Roadmap 🚀✨on Sep 6, 2023
  14. 5 remaining items

  15. lastzero commented on Sep 22, 2023

    @lastzero
    Member

    My latest commit adds support for direct streaming of videos embedded in JPEG images. To make this possible, we've added native support for the ISO base media file format on which MP4, QuickTime (MOV), and HEIC are based.

    HEIC Files

    In order to play videos embedded in HEIC image files, some more changes had to be implemented, as these are based on the same standard as the videos and therefore the HEIC at the beginning has to be ignored to find the MP4 video at the end of the file. This should also be working now.

    Related Information

  16. added
    please-testReady for manual testing & feedback
    and removed
    in-progressSomebody is working on this
    on Sep 22, 2023
  17. moved this from Development 🐝 to Preview 🐳 in Roadmap 🚀✨on Sep 22, 2023
  18. changed the title [-]Google: Initial support for Motion Photos[/-] [+]Live Photos: Add support for Google Camera Motion Photos[/+] on Sep 22, 2023
  19. added
    releasedAvailable in a stable release
    and removed
    help wantedHelp with this would be much appreciated!
    please-testReady for manual testing & feedback
    on Sep 24, 2023
  20. moved this from Preview 🐳 to Released 🌈 in Roadmap 🚀✨on Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ideaFeedback wanted / feature requestliveHybrid photo/video file format supportmetadataRelated to Exif, XMP, IPTC & Co.releasedAvailable in a stable release

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions