Last active
July 28, 2025 10:11
-
-
Save lparry/c3121b11fe5b47375a4c31e653bf1c1c to your computer and use it in GitHub Desktop.
Script to recombine the .mov/.HEIC files exported from Apple Photos when you do an "Export Unmodified Originals" and all your live photos get split apart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eou pipefail | |
recombine-live-photo() { | |
basename="${1}" | |
echo "Processing file: $basename" | |
mkdir -p "${basename}" | |
mv "${basename}."* "${basename}/" | |
cat <<EOF >"${basename}/metadata.plist" | |
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>PFVideoComplementMetadataVersionKey</key> | |
<string>1</string> | |
</dict> | |
</plist> | |
EOF | |
mv "${basename}" "${basename}.pvt" | |
} | |
main() { | |
for file in "${files[@]}"; do | |
if [[ $file == *.mov ]] && [[ -f "${file%.mov}.HEIC" ]]; then | |
recombine-live-photo "${file%.mov}" | |
fi | |
done | |
} | |
files=("$@") | |
main "${files[@]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment