Skip to main content

Add the necessary metadata to photo + video pair so Photos recognizes them as Live Photos when imported

Project description

MakeLive

All Contributors

Convert an photo + video pair into a Live Photo.

This is a simple command line tool that will apply the necessary metadata to a photo + video pair so that when they are imported into the Apple Photos, they will be treated as a Live Photo.

This is useful for converting images taken an Android phone into Live Photos that can be imported into Apple Photos.

Usage

makelive image_1234.jpg image_1234.mov

Requirements

  • macOS (Tested on 13.5.1; should work on 10.15+)
  • Python 3.9+

Installation

Install via Pre-Built Binary Installer Package

Download and run the latest installer package for your Mac architecture from the releases page.

Install via uv

Alternatively, you can install with uv:

  • Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
  • Install makelive:
uv install makelive

Alternatively, you can run makelive with uv without installing it:

uvx makelive image_1234.jpg image_1234.mov

Note: This package may not install with pip due to a dependency resolution issue. PRs are welcome.

Install from Source

To install from source:

  • Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh
  • git clone git@github.com:RhetTbull/makelive.git
  • cd makelive
  • uv venv
  • source .venv/bin/activate
  • uv pip install flit
  • flit install

API

You can use makelive to programmatically create Live Photo pairs:

from makelive import make_live_photo

photo_path = "test.jpg"
video_path = "test.mov"
asset_id = make_live_photo(photo_path, video_path)
print(f"Wrote Asset ID: {asset_id} to {photo_path} and {video_path}")

You can also check if a photo and video pair are a Live Photo pair and get the asset ID:

from makelive import live_id, is_live_photo_pair
photo_path = "test.jpg"
video_path = "test.mov"
print(f"Is Live Photo Pair: {is_live_photo_pair(photo_path, video_path)}")
print(f"Asset ID: {live_id(photo_path)}")

Live Photos can also be created as a .pvt package. Use save_live_photo_pair_as_pvt to create a .pvt package from a photo and video pair. This is useful for creating Live Photos that can be shared via AirDrop or other methods that may not preserve the Live Photo metadata. Unlike make_live_photo, save_live_photo_pair_as_pvt does not modify the original photo and video files but instead copies them into a .pvt package and modifies the copies. If the original photo and video are already a Live Photo pair, the .pvt package will be created with the same asset ID; if not, a new asset ID will be generated.

from makelive import save_live_photo_pair_as_pvt
photo_path = "test.jpg"
video_path = "test.mov"
asset_id, pvt_path = save_live_photo_pair_as_pvt(photo_path, video_path)
print(f"Wrote .pvt package to {pvt_path} with {asset_id}")

[!NOTE] XMP metadata in the QuickTime movie file is not preserved when writing the Content Identifier tag to the movie file which may result in metadata loss.

Metadata including EXIF, IPTC, and XMP are preserved in the image file but will be rewritten and the Core Graphics API may change the order of the metadata and normalize the values. For example, the tag XMP:TagsList will be rewritten as XMP:Subject and the value will be normalized to a list of title case strings.

If you must preserve the original metadata completely, it is recommended to make a copy of the metadata using a tool like exiftool before calling this function and then restore the metadata after calling this function. (But take care not to delete the ContentIdentifier metadata.)

How it works

In order for Photos to treat a photo + video pair as a Live Photo, the video file must contain a Content Identifier metadata tag set to a UUID. The associated photo must contain a Content Identifier metadata tag set to the same UUID. Unfortunately, these tags cannot be written with the standard exiftool utility if they do not already exist in the file as the metadata is stored in Maker Notes which exiftool cannot create.

This tool uses the Core Graphics and AV Foundation frameworks to modify the metadata of the photo and video files to add the required Content Identifier.

Limitations

The Live Photos created by this tool may not work as Live Wallpapers. I don't user Live Wallpapers and don't have time to debug this. I believe the issue has to do with video format and/or video length. I'm happy to accept a PR but please don't open an issue if Live Wallpapers don't work.

Caution

[!WARNING] This tool has not yet been extensively tested. It is recommended that you make a backup of your photo and video files before using this tool as it will overwrite the files which is required to add the necessary metadata. This also means that the files will be re-encoded and as a result, the file size may change, as may the quality of the image and video. I've used the native Apple APIs to do the encoding at maxixum quality but you should verify that the results are suitable for your needs.

Source Code

The source code is available here.

License

MIT License, see LICENSE for details.

Credits

The Live-Photo-master project by GUIYIVIEW was helpful for understanding how to set the asset ID in the QuickTime file. Copyright (c) 2017 GUIYIVIEW and published under the MIT License.

Thank you to Yorian who proposed this project and provided the test images. For more information, see this discussion.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Luitbald
Luitbald

💻
Jaqobs
Jaqobs

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

makelive-0.7.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

makelive-0.7.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file makelive-0.7.0.tar.gz.

File metadata

  • Download URL: makelive-0.7.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.4

File hashes

Hashes for makelive-0.7.0.tar.gz
Algorithm Hash digest
SHA256 d1f4474c4d7f4bc6fbed2fcbc2672bb49321ff031ac3867b7feb2bfcfe6a0f93
MD5 1e284fda49a380a980eb0e216fcc72e8
BLAKE2b-256 7c2637d5def338332e8a3af96b4ff81a7ef7683655d6274a8ed86191f0d137f0

See more details on using hashes here.

File details

Details for the file makelive-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: makelive-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.4

File hashes

Hashes for makelive-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d680f3f7493f8c8e7ae0574cecd4473c255b9353c51f48784e6a3890f8648b7b
MD5 4a1eda0e866312d57b0ca0369bb6ccb7
BLAKE2b-256 9557501890de51d54af4d62a1442f9660f6a9874d87c65102ce975757d7e7187

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page