Defocus from Metadata

I’m currently matching some CGI into a shot. The shot had a lot of focus pulls that I was about to eye match. I realised this information was in the arriraw metadata so I say loosely that I created a script to transfer the metadata from the exr to the defocus node in batch and it was perfect. I’m just making this known if anyone else might find this useful and I’m happy to share the script but I only tested on a few arri clips so far so can’t guarantee it always works.

You should be able to map it with an expression with no scripts needed.

Wait

What

Metadata is useful?

Say it isn’t so

Haven’t tried that side of the trick yet, but should work. it’s been helpful to create your own duplicate keys so they don’t step on the orig. (ex. cinelens_distance or cinelens_iris)

Camera metadata can change format per manufacturer. also some tools don’t appreciate animated metadata, especially w slips. Workaround is baking the curves.

Its on my list of RnD to “unwrap” distortion and vig on plates w anim data from camera, but at the moment i’m finishing a tool to swap lenses as easily as the real deal. full sets 2x SPH and 2x ANA.

once you have setup, it helps to make a procedural solution so that they hook automatically to many tools at once. (distortion, DoF, vig, etc)

Also happy to share process to interested folk. Drop me DM

I’ll attach my file to this message incase its of use. Maybe it could be added to the bigger picture. I’m currently looking for some Sony & Red Exrs to get it working on those as well.

M

extract_lens_metadata.py (20.7 KB)

  1. Right-click the plate → Lens Metadata → Extract Focus Curve
  2. Enter the distance from camera to your element in metres. Check the Batch start frame and bokeh aspect (pre-filled from the lens squeeze). OK.
  3. Add a Blur, set it to Defocus, Load Setup, pick the .blur_node it wrote to your Desktop.

Sample footage is available from arri, red and Sony.

Just search the websites, download and transcode.

Or soft import, inject synthetic metadata (or not)

and export.

To get proper DoF you’ll also want to grab the sensor size and the tStop.

Script looks good.

Camera metadata from source sometimes has the focus embedded in metadata keys. this is where i would copy that info to a “cinelens_*” metadata key. If diff camera metadata format, then it can all be sanitized to your own defined keys.

Once you have the keys to link, you could have a version that automatically matches distance from plate.

-Andy D