Copy link to clipboard
Copied
I'd like to reproduce the behavior of Metadata -> Edit Capture Time in a script. Is it possible to do so?
(I know I can use ExifTool and refresh the file's metadata. But I'm specifically interested in setting the "Date Time Original" of a video, and that can't be controlled by the video file's metadata—it seems to be a property that is only tracked internally by Lightroom, and only possible to set via "Edit Capture Time".)
Thanks for the helpful background.
So the short answer is "no". The "Date Time Original" metadata tag is read-only for the SDK.
Investigating the use of IPTC Date Created a little more:
Copy link to clipboard
Copied
LR does read the metadata initially from a video when its imported to read the capture time, though that's buggy for some video formats. When it can't read the capture time, it uses the file system's last-modified or created date maintained by the operating systems of the camera and the computer (LR has changed which one it uses over the years, and I can never remember). But that's buggy too.
Unfortunately, ExifTool / metadata refresh doesn't work with video because LR doesn't implement photo:readMetadata() for videos:
Adobe did a rushed, sloppy job of implementing video in LR 3 and 4, never finishing the missing features and leaving many bugs.
Doubly unfortunately, the SDK doesn't allow you to do photo:setRawMetadata ("dateTimeOriginal").
However, on a lark just now, I retested photo:setRawMetadata ("dateCreated"), which sets the IPTC Date Created field. In past versions, editing the IPTC Date Created field (either in the user interface or via the SDK) would correctly set that field, but LR's internal notion of capture date/time would not change (e.g. the date/time showed under thumbnails in Library grid view or in the Metadata Default view).
But in LR 8, it seems to work. I haven't tested it thoroughly yet -- it may still trigger existing various inconsistencies (bugs) in capture date that have long been preset and Adobe hasn't been able to fix. If setting IPTC Date Created does work consistently, that would be a major convenience for many plugins that set capture date/time.
Copy link to clipboard
Copied
Thanks for the helpful background.
So the short answer is "no". The "Date Time Original" metadata tag is read-only for the SDK.
Investigating the use of IPTC Date Created a little more:
There are some useful tools here for special-purpose use cases, but nothing good enough for a general-purpose workaround.
Copy link to clipboard
Copied
- If, at this point, "Date Created" is set (either manually or via the SDK), this updates the "Capture Date", though it has no effect on <sort date>.
- At some point, I can do a "Edit Capture Time" with a shift of 0 hours. This has the effect of copying the "Capture Date" (I think) into the "Date Time Original" field. It also updates <sort date>.
- Once the video has a "Date Time Original", subsequent changes to "Date Created" are ignored by "Capture Date" and <sort date>.
Shoot, so doing photo:setRawMetadata ("dateCreated") still creates an internal inconsistency: Lightroom: Still inconsistent capture date/time for photos and videos | Photoshop Family Customer Co... . And thus, plugins can't use it for changing the capture date/time. :-<