Making better timelapses with Lightroom and JavaScript

Javier Bórquez2022.02.13

I like timelapses, I think they can capture the feeling of a moment better than a single picture, especially when the light is changing and that feeling is evolving with it. I post some of my favorite timelapses to If you want to jump directly to the code, here it is.

Long, blue hour, timelapses can be hard.

The light conditions at the blue hour change, fast. If you let the camera go all-in auto the result is going to be a of lot jumps in brightness from picture to picture, but, if you go all manual the last picture can be pitch dark.

Take for example these photos, the first and last of a timelapse that I took that only lasted 7 and a half minutes with all manual settings. (Shoot on Gyon, Kyoto. f8, 1/3s, ISO 160 on X-T3).

In only 7 minutes and the photo went from "I like it" to "too dark for my taste". Additionally, both images may look good but they do not reflect what I felt at the moment. I vividly remember the scene going from energetic, bright, and golden to peaceful, intensely blue, and dreamy.

The camera is not able to capture what my eyes saw and I felt, but I can approximate it better like this:

I really like both images now, and they both reflect as best as I can how I felt at the beginning and the end of the timelapse. Now there is a problem to solve: I changed too many things between the pictures, exposure, white balance, highlights, shadows, and so on. And I have 418 photos to edit now.

Making a smooth transition between edits with Lightroom CC and JavaScript.

I use the new Lightroom CC which has no plugin support, but that does not mean that we can not make our own hacky one.

Here is the plan:

  1. Edit only the first and last photos. We will interpolate the edits in all others.
  2. Export the original files and settings and identify which parts of the settings we want to transition.
  3. Make a script that reads the first and last settings and rewrites all others based on how close they are from the start and end of the timelapse.
  4. Reimport the files to lightroom.

Exporting in my case looks like this, which saves a .raf file (I'm using Fujifilm) and an .xmp file, which seems like some kind of XML file that lightroom uses to store all the edit settings.

Taking a look at the .xmp file we can learn some thing, for example, it stores EXIF data, but more importantly, it includes information about all the sliders that I touched:






This slider for example shows the color adjustment that I made.

At this point, I should probably see if I can learn more about the values reading the XMP specification. I took a look but instead decided to try an experiment with the script now.

Here is the script:

cd folder_with_all_xmp
npx lightroom-interpolator .

It reads all the .xmp files on the folder, finds the first and last one by ordering them by name, and interpolates all the rest. It saves a copy of every .xmp to a new ./bak folder.

I exported all my photos, ran the script on my folder, deleted the photos from lightroom and imported the new ones and it works!

And that is it, now you can gradually apply any Lightroom setting you want over a long list of pictures.

One note, while I was importing my photos again Lightroom only showed the RAW photo as a thumbnail, only after I finished importing and clicking "add photos" I got new previews with all the interpolated edits.

The camera on the table can be a little bit shaky but the colors transitions are smooth.

Bonus: This is the command that I use to make a video from my pictures with ffmpeg.

ffmpeg -r 60 -pattern_type glob -i '*.jpg' -s 720x1080 -vcodec libx264 -crf 18 -preset slow -pix_fmt yuv420p timelapse60.mp4

Additional tips to make the technique work.

Some things that I do while taking timelapses:

That means the camera will have to do only one thing, auto ISO, but if you are taking raw pictures then you'll control that later with post and compensate the difference of natural light with this script.

2024 Javier Bórquez