85: Adjusting photo timestamps with Exiftool

The nicest camera in my house is a Canon T3i. It's about five years old and for my needs it still takes fantastic pictures. One thing it doesn't do is keep accurate time. That's not its purpose; it's precision optics, not a precision chronograph.

But photo timestamps matter, and I always forget to check my camera's clock before going on a big trip. A week later, I have 1500 photos from the T3i that don't line up with the 100 or so photos I took on my phone (largely panoramas, something the iPhone does really well and SLRs don't handle). If the camera kept good time, this wouldn't happen, or at least the solution would be simple.

Most photo organization apps, like Lightroom, which I use, have the ability to batch correct photo timestamps — if you forgot to adjust your camera's time zone. I was in California, so I had that problem, but correcting three hours westward wouldn't solve it; my timestamps were some 3 hours and 18 minutes off from my iPhone photos.

I suspected my solution would lie on the command line — spoiler alert: it was — but I searched for a GUI tool designed for this task. An $8 mini version of A Better Finder Attributes claims to be a timestamp unitasker, but I couldn't sort out the ABFAX demo's interface. HoudaGeo, primarily designed for geotagging, will tackle the problem, but at $40 it's priced for users who will take advantage of all of its features.

So I turned to Exiftool, an omnibus photo metadata munger for the command line. It was quick to install with Homebrew, and I found the one-line command I needed in its documentation. (I had to run it twice on the first batch of photos, because I adjusted 18 minutes in the wrong direction!) Adding a simple Bash for loop blasted through 1200 more photos in no time.

for d in 2016-08-*; do exiftool "-DateTimeOriginal-=0:0:0 0:17:32" $d; done

Another loop removed the archived originals that Exiftool thoughtfully creates…although that can amount to gigabytes of extra storage when processing lots of photos.

Even after that, my photos weren't sure what time zone they were in. Lightroom displayed the unaltered iPhone photos in what would be Eastern Standard Time, even though we're currently observing Daylight Saving Time. I gave up on aligning them to a "true time" as long as SLR and iPhone would happily interlace. And they did, except for the iPhone videos (7 hours off) and some iPhone shots identified as coming from an "Unknown Camera" (5 hours off). But with a few tweaks, all is in order. Now, thanks to a little command line magic and some persistence, I can relive my trip in order.