ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: dhackney on July 15, 2011, 01:07:13 PM

Title: SOLUTION: Synchronize all date/time fields
Post by: dhackney on July 15, 2011, 01:07:13 PM
Solution name: lr-datetime-equalize

Current Version: V1.00 2011/07/15

Metadata type/form, e.g. photo, video, PDF, etc.: photo

Solution type, e.g. date/time, filename, etc.: date/time

Platform: Windows

Purpose: To match all photo file date/time metadata fields to the same master date/time value.

Problem solved: Many photo organizing and editing tools allow the change of one or more date/time metadata fields. Doing so leaves the photo file(s) with some date/time fields that do not match. Different photo geotagging, organizing and editing tools, as well as photo hosting web sites, use different date/time metadata fields to establish the date/time for the photo. This can cause many problems related to geolocation, photo sorting, photo display order, etc. By equalizing, or matching, the date/time information across all metadata date/time fields, the photos will will be treated processed, displayed, etc. the same by all photo tools and web sites.

Relevant applications: Digital photo or video files whose date/time was edited by any photo organizing / editing application that allows the edit of a subset of the date/time metadata fields, e.g. Adobe Lightroom, Adobe Photoshop Elements, etc.

Brief description: Microsoft Windows batch file that calls exiftool and exiftool arguments file. This utility equalizes/matches/synchronizes date/time metadata across all relevant JPG, CR2 and XMP file metadata fields.

Full description: A utility to distribute a master date/time across all date/time metadata fields in all relevant photo files. This utility was created to solve the challenge that Adobe Lightroom's "edit capture time" does not write the updated capture date/time to all date/time metadata fields in all relevant files.

lr-datetime-equalize utility batch file documentation:
rem         * This batch file processes all xmp, cr2 and jpg files in a directory and its subdirectories.
rem
rem     * This batch file requires the parameter file lr-datetime-equalize.args for data field mapping.
rem
rem     * Put this batch file and the lr-datetime-equalize.args file in the directory with the files you
rem         wish to process.
rem
rem       * This batch file processes Canon CR2 (RAW) files first, then JPG files.
rem
rem       * If you wish to use this utility for non-Canon RAW files, edit the file name extension CR2 and cr2
rem         below to your applicable RAW filetype extension, e.g., NEF.
rem
rem       * To see more detail about the operations performed, add a -v to the exiftool command lines below.
rem         The level of detail increases with each of the following increments of the variable:
rem         -v, -v0, -v1, -v2, -v3, -v4, -v5
rem
rem     * This batch file requires an installed copy of ExifTool by Phil Harvey.
rem
rem     * Download the ExifTool windows command line version and rename the file exiftool.exe.
rem
rem     * Place the exiftool.exe file in your windows directory or on your system path.

lr-datetime-equalize utility ExifTool arguments file documentation:
# Notes:        * This arguments file sets the master (canonical) source metadata field for date/time
#                 data as: XMP-xmp:CreateDate
#
#               * The XMP-xmp:CreateDate field was chosen as master because Adobe Lightroom changes the
#                 XMP-xmp:CreateDate field in both RAW sidecar XMP files and standalone JPG files when
#                 the "Menu: Metadata : Edit capture time" is used.
#
#               * If you use a different photo organizing / editing application, you may want or need
#                 to choose a different master date/time field. You can change the master date/time
#                 field in the metadata date/time field mappings below.
#
#               * All date/time fields of all relevant photo files are set to match the value in the
#                 master source XMP-xmp:CreateDate field.
#
#               * The MetadataDate field is set to the current date and time that the utility executes.
#
#               * RAW files' CR2 and sidecar JPG and XMP files' date/time metadata fields are
#                 populated from the XMP file's XMP-xmp:CreateDate metadata field.
#
#                 RAW files Example:
#                  1. sample.cr2
#                  2. sample.jpg
#                  3. sample.xmp
#                 Each set of RAW files are treated as a unit. All date/time fields in each RAW file
#                 unit are populated with the value in the XMP-xmp:CreateDate field in their .xmp file.
#                 The date/time meta data fields in sample.cr2 and sample.jpg are populated with
#                 the date/time value in the XMP-xmp:CreateDate field in sample.xmp.
#                 All other date/time meta data fields in sample.xmp are populated with
#                 the value in the XMP-xmp:CreateDate field in sample.xmp.
#
#               * JPG files' date/time metadata fields are populated from their XMP-xmp:CreateDate
#                 field.
#
#                 JPG file example:
#                  1. sample-two.jpg
#                 Each JPG file is treated as a single source of date/time information for that file
#                 and that file alone.
#                 In this example, all date/time fields for sample-two.jpg are populated with the date
#                 from the XMP-xmp:CreateDate field in sample-two.jpg.
#
#
#               * If you wish to drive the master date/time from another field other than
#                 XMP-xmp:CreateDate field, edit the parameters below.
#               
#               * The batch file that calls this arguments file processes Canon CR2 (RAW) files first, then JPG files.
#
#               * This process populates all datetime fields in all file types: CR2, JPG and XMP
#     
#               * If you wish to use this utility for non-Canon RAW files, edit the batch file to change the filename
#                 extension CR2 and cr2 to your applicable RAW filetype extension, e.g., NEF. You may also need to change the
#                 MakerNotes:TimeStamp tag in this arguments file to match your RAW file metadata tag name.
#
#               * To exclude a date/time metadata field from being populated, edit this file and place a # in the first column
#                 the relevent mapping line. For example, by default, the tiff:DateTime field mapping is disabled by a #.


Code / command line: lr-datetime-equalize

The required files, lr-datetime-equalize.bat and lr-datetime-equalize.args, are included as a .zip file attached to this post.

Caveats/limitations:


NewbieNotes (specific notes for newbies explaining basic concepts, caveats, etc.):

This utility makes use of a Windows batch file to display information to the user and to control the execution of ExifTool. The batch file contains several useful batch file commands and parameters that you can copy and use in your own batch file, including:

This utility also uses an ExifTool arguments file to provide the mapping of the source and target date/time metadata fields. The arguments file can be used as a template for your own projects.

Note that in the ExifTool command line in the Windows batch file the current working directory is specified with a single period "." character.


Keywords: Adobe, Adobe Lightroom, date, time, date/time, photo sort, photo display order, change date, sychronize dates, match dates, fix date/time, fix date, fix time


Additional information:
Photo Metadata overview: http://www.hackneys.com/travel/docs/metadataoverview.pdf
Excel spreadsheet detailing photo metadata date/time fields and Adobe Lightroom date/time metadata fields: http://www.hackneys.com/travel/docs/photo-metadata-datetime.xls



[edit: added caveat info and wordsmithing; current version; link to XL spreadsheet of photo date/time info]
[PH: changed subject and Tags-->Keywords and attached required files]
Title: Re: Synchronize all date/time fields
Post by: tucsonbil on September 27, 2011, 04:44:02 PM
Good afternoon:

Hoping you can help a Mac user ...

I'm using iPhoto (latest) and am trying to embed the date / time into the EXIF data for each photo. I have  24,000+ photos. Most of the photos are accurately embedded with the time/date, but thousands have been scanned and imported with "the date" modified to reflect when the original photo was taken (but these dates/times are not embedded in the EXIF data) ...

I need something that will advance through the photos from oldest to newest AND that recognizes the existing date / time (embedded or not) of each individual photo and THEN adds 1 second of time to that and then saves (e.g., "Adjust" button) the photo ("Adjust date/time" -> Modify original files") ...

I think that the problem here is that when a scan is imported into iPhoto there is no EXIF data related to the date. The "date" which is listed on the photo (in iPhoto) is the date/time of the import. Most of my imported scans were manually time shifted ... without "modifying the original file" ... so there is no EXIF date data embedded in the first place (iPhoto must maintain a separate database of dates in these cases)

Do you think this is something that your work can be modified to work with?

PH Edit:  This is a duplicate post.  See my response here (https://exiftool.org/forum/index.php/topic,3621)