Skip to content

mihir-io/MotionPhotoMuxer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MotionPhotoMuxer

Note I've switched back to Android for the time being. I do have access to an iPhone for testing, but likely won't be focusing on developing this much further.

Convert Apple Live Photos into Google Motion Photos commonly found on Android phones.

Installation

As of right now, this script only has one dependency, py3exiv2. Unfortunately this requires building a C++ library to install, so you need to install a C++ toolchain.

Using Ubuntu as an example:

sudo apt-get install build-essential python-all-dev libexiv2-dev libboost-python-dev python3 python3-pip python3-venv
python3 -m pip install -r requirements.txt

Installing on a Pixel/Android Phone

'pkg install python3'
'pkg install git'
'pkg install build-essential'
'pkg install exiv2'
'pkg install boost-headers'
git clone https://github.com/mihir-io/MotionPhotoMuxer.git
python3 -m pip install -r MotionPhotoMuxer/requirements.txt

This should leave you with a working copy of MotionPhotoMuxer directly on your Pixel/other Android phone. You may want to make sure Termux has the "Storage" permission granted from within the system settings, if you plan on writing the output files to the /sdcard/ partition.

Usage

usage: MotionPhotoMuxer.py [-h] [--verbose] [--dir DIR] [--recurse] [--photo PHOTO] [--video VIDEO] [--output OUTPUT] [--copyall]

Merges a photo and video into a Microvideo-formatted Google Motion Photo

options:
  -h, --help       show this help message and exit
  --verbose        Show logging messages.
  --dir DIR        Process a directory for photos/videos. Takes precedence over --photo/--video
  --recurse        Recursively process a directory. Only applies if --dir is also provided
  --photo PHOTO    Path to the JPEG photo to add.
  --video VIDEO    Path to the MOV video to add.
  --output OUTPUT  Path to where files should be written out to.
  --copyall        Copy unpaired files to directory.

A JPEG photo and MOV or MP4 video must be provided. The code only does simple error checking to see if the file extensions are .jpg|.jpeg and .mov|.mp4 respectively, so if the actual photo/video encoding is something funky, things may not work right.

Note The output motion photo tends to work more reliably in my experience if the input video is H.264 rather than HEVC.

This has been tested successfully on a couple photos taken on an iPhone 12 and uploaded to Google Photos through a Pixel XL, but there hasn't been any extensive testing done yet, so use at your own risk!

Credit

This wouldn't have been possible without the excellent writeup on the process of working with Motion Photos here.

About

Convert Apple Live Photos into Google Motion Photos

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages