Making better timelapses with Lightroom and JavaScript
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 https://javier.xyz/timelapses/. 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:
- Edit only the first and last photos. We will interpolate the edits in all others.
- Export the original files and settings and identify which parts of the settings we want to transition.
- 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.
- 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:
exif:ExifVersion="0230"
exif:ExposureTime="1/3"
exif:ShutterSpeedValue="1584963/1000000"
exif:FNumber="8/1"
exif:ApertureValue="6/1"
[...]
crs:SaturationAdjustmentRed="+11"
crs:SaturationAdjustmentOrange="+9"
crs:SaturationAdjustmentYellow="+11"
crs:SaturationAdjustmentGreen="+42"
crs:SaturationAdjustmentAqua="0"
crs:SaturationAdjustmentBlue="+29"
crs:SaturationAdjustmentPurple="+35"
crs:SaturationAdjustmentMagenta="+24"
And
crs:Shadows2012="+47"
crs:Whites2012="-15"
crs:Blacks2012="+99"
crs:Clarity2012="+14"
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: https://github.com/javierbyte/lightroom-interpolator
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:
- Do not use auto aperture. If the camera decides that it is time to change the aperture it will make the brightness jump, even if it compensates with ISO.
- Keep the same shutter speed as long as possible. I prefer to set the shutter speed and if I see the image going too dark then I may manually intervene once and change it until I'm a bit overexpoed again. Syncing the light of two timelapses is better than having to sync each and every picture.
- Start a little bit overexposed, you'll need that extra light.
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.