Nodes/ComfyUI-Depth-Pro/Focal from List
ComfyUI Node

Focal from List

Pick one frame's focal length out of a batch

By spacepxl·Created 2 years ago·Updated 2 years ago· 209
Focal from List
  • focal_list
  • focal
  • focal_str
batch_index

When you run a batch of frames through this pack's Depth Pro node, you get two focal-related outputs: a per-frame list and a single average. focal_avg is usually what you want - one number for the whole shot. But sometimes you need the focal for a specific frame, and that's the one job this node exists for.

It's a tiny piece of plumbing, honestly. It takes the focal_list (the LIST output of Depth Pro) and a batch_index, and it returns the focal at that position. Two inputs, two outputs, one index.

Inputs and outputs

  • focal_list - the per-frame focal_list from the Depth Pro node.
  • batch_index (INT) - which frame's focal you want. First frame is 0.

One nice touch in the source: the index is clamped to the valid range rather than left to crash. Ask for frame 999 in a 5-frame batch and you silently get the last frame's focal instead of an error. Good behavior, and it means you can drive the index from a video's frame count without babysitting edge cases.

Outputs are focal (FLOAT) and focal_str (STRING) - the same number as a string formatted to two decimals, which is handy for feeding text-based or display nodes that choke on raw floats.

When you'd actually use it

The realistic case is per-frame camera work in a parallax or 3D-projection pipeline: you're pairing each frame's focal with the matching frame's metric depth, and the average would be subtly wrong for a shot where the camera zooms or the subject distance shifts. Grab the frame's own focal and you keep everything consistent. For single images - most uses - the average is fine and this node is redundant. It's not overengineered; it's just there when you need it.

Install

Same pack, same steps as everything in ComfyUI-Depth-Pro:

cd ComfyUI/custom_nodes
git clone https://github.com/spacepxl/ComfyUI-Depth-Pro

or search ComfyUI-Depth-Pro in ComfyUI Manager and restart. If you haven't run a depth model yet, be ready for the first-run model download, and if you see vit_large_patch14_dinov2 errors, update timm - tested versions are 0.9.16 and 1.0.9 per the README.

CategoryDepth-Pro

Inputs (2)

NameTypeDefaultDescription
focal_listLIST
batch_indexINT

Outputs (2)

NameTypeDescription
focalFLOAT
focal_strSTRING