3

This question already has an answer here:

My wife and I took some photos at an event, which we would like to merge into a single set arranged in order of capture time. We thought this would be easy, just rename them in sequence ordered by capture time. Unfortunately our cameras disagree on the current time, so the timestamps are offset from each other by a known (and constant) ammount.

Does anyone have a good way of merging these into a single series? There are several hundred shots from each camera so it will need to be done automatically.

My main machine runs Linux but I have Windows available as well so solutions on either OS are helpful

marked as duplicate by inkista, Hueco, Crazy Dino, Mark Whitaker, Michael C Mar 4 '18 at 21:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Rather than limiting the question/answer to exactly and only a one hour offset, could we expand the question to include other time amounts? Such as a number of days, minutes, or seconds (or a combination of hours-minutes-seconds) such as 1hr:2min:27sec? – Michael C Jan 26 '18 at 3:27
  • good idea, I'll change the wording to only specify that the time offset is known and constant – Joseph Rogers Jan 26 '18 at 9:16
7

ExifTool is my go-to tool for time-shifting photos.

Assuming Windows, to add 1 hour to all date/time fields stored in the photo metadata:

exiftool.exe -AllDates+=1 C:\path\to\folder\of\photos

or to subtract one hour:

exiftool.exe -AllDates-=1 C:\path\to\folder\of\photos

By default, this will make a copy of the original as backup before modification. To do the modification in place, use the flag -overwrite_original_in_place:

exiftool.exe -AllDates-=1 -overwrite_original_in_place C:\path\to\folder\of\photos

You can use exiftool to move and rename files based on date/time. To organize photos into nested folders "Year/Month/Day/" with each photo named "image_HourMinuteSecond.[ext]" where the file will maintain its original extension (i.e., JPGs will stay JPGs, DNGs will stay DNGs):

exiftool.exe -d C:/path/to/put/organized/photos/%Y/%m/%d/image_%H%M%S.%%e "-filename<createdate" C:/path/to/folder/of/photos

Note that exiftool doesn't care which direction slashes you use for directories.

For more details about file moving/renaming see this documentation.

ExifTool has options for "dry-running" things, but I often end up zipping up a folder or copying it first before running my commands that rename/move files to make recovery easy just in case it doesn't do quite what I intended.


Additional usage:

Some of these examples are my own, while some come directly from the exiftool documentation reproduced here for convenience.

Fine-grained date/time adjustment. This is the long form to subtract 1 hour, for which the above is a shortcut:

exiftool.exe "-AllDates-=0:0:0 1:0:0" C:\path\to\folder\of\photos

So, To add 5 years, 10 months, 2 days, 10 hours, 48 minutes, and 4 seconds:

exiftool.exe "-AllDates+=5:10:2 10:48:4" C:\path\to\folder\of\photos

Filter by date/time before adjusting. I use this to fix a missed DST adjustment within a large group of pictures, it filters out anything before the time-shift:

exiftool.exe -if '$createdate gt "2012:03:11"' -AllDates+=1 -overwrite_original_in_place C:\path\to\folder\of\photos

You can run the tool recursively, meaning it will repeatedly go in to all subdirectories of the given path:

exiftool.exe -r C:\path\to\folder\of\photos -AllDates+=1

You can filter by file extension if you want to fix DNGs, but not JPGs, for example:

exiftool.exe -ext dng -AllDates+=1 C:\path\to\folder\of\photos

You can combine all these. Recursively find all JPGs created after Mar 11, 2012 and add 1 hour to the all dates by modifying the files in place:

exiftool.exe -r C:\path\to\folder\of\photos -ext jpg -if '$createdate gt "2012:03:11"' -alldates+=1 -overwrite_original_in_place
  • Looks like exactly what I need, thanks! As is customary I'll wait a day before accepting an answer but have a +1 in the mean time – Joseph Rogers Jan 26 '18 at 0:23
  • To make this answer more usable to more people, would it also be possible to add an example of a command to advance the time by days, minutes, or seconds as well as by hours? – Michael C Jan 26 '18 at 3:25
  • Note that exiftool can also rename the files based on Exif fields, if you're concerned about the filenames as well (hinted at in the question). – junkyardsparkle Jan 26 '18 at 6:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.