Lightroom Edit Capture Time XMP vs. EXIF

dhackney

Expedition Leader
PDF version of this document is here: http://www.hackneys.com/travel/docs/lrdatetimeexifbugfix.pdf

Scope:
- Lightroom (LR) 1.4.1 and 2 Beta
- Any file that is edited using Metadata:Edit Capture Time
(Note: detail info below may be helpful to those seeking to understand date/time problems/issues with LR and other tools)


Background:
LR allows editing/offsetting of image capture time via the “Metadata:Edit Capture Time” menu option.

Changing the time in LR alters the following EXIF date/time metadata fields as displayed in LR:
- Date Time Original
- Date Time Digitized
- Date Time

Writing the LR metadata to the image file via the “Metadata:Save Metadata to File” command writes the values into the image’s relevant EXIF and XMP date/time metadata fields.


Challenge:
LR writes the correctly edited times into the XMP date/time metadata fields but writes incorrect times into the EXIF date/time metadata fields.

LR uses XMP date/time metadata fields for its displayed time data, not EXIF date/time metadata fields. As a consequence, the user does not know the EXIF time fields have been incorrectly changed unless they check them in a tool that displays or uses the EXIF date/time metadata fields.


Solution:
Use a batch file based on exiftools to copy the LR edited XMP date/times into the EXIF date/time metadata fields.


Resources:
- Batch file LR XMP/EXIF date/time bug fixer here - LR-xmpdatetime2exif.bat: http://www.hackneys.com/photos/lr/LR-datetimexmp2exif.bat
- Batch file arguments file (required) here LR-xmpdatetime2exif.args: http://www.hackneys.com/photos/lr/LR-datetimexmp2exif.args

A few useful tools to better understand this challenge:
- Batch file to display relevant time metadata fields here - list-exif-tags-sample-datetime.bat: http://www.hackneys.com/photos/lr/list-exif-tags-sample-datetime.bat
- Batch file to display set of EXIF metadata here - list-exif-tags-sample.bat: http://www.hackneys.com/photos/lr/list-exif-tags-sample.bat
- Batch file to display set of XMP metadata here - list-xmp-tags-sample.bat: http://www.hackneys.com/photos/lr/list-xmp-tags-sample.bat
- Batch file to display complete set of metadata here- list-metadata-tags-sample.bat: http://www.hackneys.com/photos/lr/list-metadata-tags-sample.bat
- Sample photo file here – sample.jpg: http://www.hackneys.com/photos/lr/sample.jpg



Preparation:
All batch files require an installed copy of exiftools by Phil Harvey (free) available here: http://www.sno.phy.queensu.ca/~phil/exiftool/
1. Download exiftools windows command line version and rename the file exiftools.exe.
2. Place the exiftools.exe file in your windows directory or on your system path.


Utilization:
1. In Lightroom, select the folder containing the photos you need to fix.
2. In Lightroom, select all the photos you need to fix.
3. In Lightroom, select Metadata:Save Metadata to File (this step ensures you don’t lose any Lightroom specific metadata that has not yet been embedded in the file).
4. Using Windows Explorer or another utility, backup your jpg files
5. Using Windows Explorer copy the LR-xmpdatetime2exif.bat and LR-xmpdatetime2exif.args files to the folder with the jpg files you need to fix.
6. Using Windows Explorer double click on LR-xmpdatetime2exif.bat
7. Wait for the batch file to process.
8. In Lightroom, ensure the photos you just fixed are still selected, if not, re-select them.
9. In Lightroom, select Metadata:Read Metadata from File (this step ensures that Lightroom has all the revised EXIF date/time meta loaded).


Detail:
This challenge is a subset and another manifestation that LR 1.4 uses the XMP date/time metadata fields, not the EXIF metadata fields that other programs use and rely on. There have been numerous posts regarding other manifestations of this problem.

Most of the confusion relates to several primary factors:
1. Cameras embed EXIF metadata into photo files. Adobe products, and some others, support XMP metadata, which is not part of the EXIF standard. If a tool was developed prior to XMP, such as Exifer or Paint Shop Pro (PSP) 9, then that tool has no way to view or edit XMP metadata. If a tool only displays, edits and maintains XMP, such as LR, then the two data sets can become de-coupled for common data points, such as date/time. If a tool relies on the EXIF version of a common data point, such as RoboGEO, but the date/time was edited by a tool that only maintains XMP data, such as LR, then the EXIF dependent tool will be working with out-of-synch data.
2. LR, Photoshop Elements (PSE), Bridge, etc. use, either exclusively or primarily, XMP metadata, even though they may label/display it as EXIF. LR, for instance, only displays the XMP date/time values, even though they are labeled EXIF.
3. The EXIF specification assigns time field names different than those commonly used in various tools when labeling/displaying EXIF date/time metadata fields. You will find the very same EXIF date/time field labeled a wide variety of different ways in a sample set of even a handful of tools.
4. The XMP specification has a namespace area labeled EXIF. Adding to the confusion even more, the XMP-EXIF namespace has date/time field names that duplicate those of EXIF date/time fields.

As you can see, if you add these four factors together, it is no surprise there is widespread confusion related to photo file date/time in general and LR’s handling of it in particular.



Relevant Time Metadata Fields

EXIF Metadata

Tag ID…….Tag-Name…………………….Comments
-----------------------------------------------------------------------------------------------------------------------------
0x0132…… ModifyDate…………………. (called DateTime by the EXIF spec)
0x882a…… TimeZoneOffset…………….. (1 or 2 values: 1. The time zone offset of DateTimeOriginal from GMT in hours, 2. If present, the time zone offset of ModifyDate)
0x9003……. DateTimeOriginal
0x9004……. CreateDate………………….. (called DateTimeDigitized by the EXIF spec)


XMP-EXIF Metadata
(XMP metadata is segmented by namespaces. The main section is called Dublin Core, commonly referred to as dc. XMP also has a namespace called EXIF.)

Namespace……..Tag-Name……………….Comments
-----------------------------------------------------------------------------------------------------------------------------
dc……………….Date
EXIF……………DateTimeDigitized………[note duplication of original EXIF specification field name]
EXIF……………DateTimeOriginal………..[note duplication of EXIF field name]

(source: exiftool by Phil Harvey documentation, [ ] comments are my own)

Note that in LR, the date/time information displayed in the Metadata panel is not the EXIF date/time field metadata, it is the current contents of the XMP-EXIF namespace date/time field metadata contained in the LR database.


LR Example

Here’s an example of the metadata from a file before and after editing the time in LR and saving the metadata to file.

Steps:

1. Extract photo time metadata info via exiftools.

Photo data after step 1:
EXIF Date/Time Original : 2008:05:09 15:48:23
EXIF Create Date : 2008:05:09 15:48:23
EXIF Modify Date : 2008:05:09 15:48:23
XMP-EXIF Date/Time Digitized : 2008:05:09 15:48:23-07:00
XMP-EXIF Date/Time Original : 2008:05:09 15:48:23-07:00​

2. Import test photo into LR catalog.

Lightroom Metadata after step 2
Date Time Original 5/9/2008 3:48:23 PM
Date Time Digitized 5/9/2008 3:48:23 PM
Date Time 5/9/2008 3:48:23 PM​

3. Select Metadata:Edit Capture Time.

4. Edit capture time + 3 hours.

Lightroom Metadata after step 4
Date Time Original 5/9/2008 6:48:23 PM
Date Time Digitized 5/9/2008 6:48:23 PM
Date Time 5/9/2008 6:48:23 PM​

5. Metadata:Save Metadata to File.
6. Extract photo time metadata info via exiftools.

EXIF Date/Time Original : 2008:05:09 11:48:23
EXIF Create Date : 2008:05:09 11:48:23
EXIF Modify Date : 2008:05:09 11:48:23
XMP-EXIF Date/Time Digitized : 2008:05:09 18:48:23-07:00
XMP-EXIF Date/Time Original : 2008:05:09 18:48:23-07:00​
Results:
XMP-EXIF date/time fields are correctly shifted +3 hours.
EXIF date/time fields are incorrectly shifted -4 hours.​
The results are the same in LR 1.4.1 and 2 Beta.



Environment:
OS: Windows XP Pro
LR: 1.4.1


[end Lightroom (LR) Edit Capture Time XMP vs. EXIF]
 
Last edited:

Forum statistics

Threads
186,051
Messages
2,881,430
Members
225,825
Latest member
JCCB1998
Top