Add standalone set_mtime_from_metadata.py utility

Extracted the mtime-stamping logic added to concat_live_clips.py into
its own dependency-free script (just needs ffprobe), so it can be run
against any video file -- not just Live Photo clips -- to fix a
mismatched filesystem mtime for tools like Synology Photos that sort
videos by mtime instead of parsing embedded metadata.
This commit is contained in:
2026-07-26 13:01:50 -04:00
parent 20c5216afc
commit 5fa68dac76
2 changed files with 119 additions and 0 deletions
+19
View File
@@ -123,3 +123,22 @@ Continuous runs (copy-paste to re-run on just that subset):
Run 3 (3 clips): IMG_2451.MOV IMG_2452.MOV IMG_2453.MOV
Run 4 (1 clip): IMG_2454.MOV -- nothing to concatenate on its own
```
## Bonus utility: set_mtime_from_metadata.py
A standalone script (no `numpy` dependency, just `ffprobe`) that sets a video
file's filesystem mtime to match its own embedded creation-time metadata.
Not specific to Live Photos or this repo's main script — useful for any
video whose filesystem timestamp doesn't match its metadata (e.g. after
copying, downloading, or exporting), for tools like Synology Photos that
sort/date videos by mtime instead of parsing the embedded metadata.
```bash
./set_mtime_from_metadata.py video1.mov video2.mp4 ...
./set_mtime_from_metadata.py --dry-run *.mov # preview without changing anything
```
Prefers the Apple `com.apple.quicktime.creationdate` tag (local time) when
present, falling back to the generic `creation_time` tag (usually UTC).
Files with no usable timestamp, or that don't exist, are skipped with a
warning and a non-zero exit code; the rest of the batch still runs.