Nodes/Deforum Nodes/(deforum) Cadence Interpolation
ComfyUI Node

(deforum) Cadence Interpolation

How Deforum gets a buttery animation from a handful of renders

By XmYx·Created 3 years ago·Updated 3 months ago· 198
(deforum) Cadence Interpolation
  • image
  • first_image
  • deforum_frame_data
  • hybrid_images
  • IMAGE
  • IMAGE
depth_strength1.00
previewfalse

The expensive part of a Deforum animation is diffusion, and most of the frames in a smooth video don't need it. Cadence is the trick that exploits that: you fully diffuse every Nth frame, then fill the gaps by warping the previous frame toward the next using depth and optical flow. (deforum) Cadence Interpolation is the node that does that filling, and it's the single biggest quality-per-frame win in this whole pack.

What it is

Think of it as Deforum's own in-betweening. The node takes the current rendered frame plus the first frame of the run, and uses a depth model (MiDaS-class) plus an optical-flow model (RAFT) to warp frames between the sparse diffusion keyframes. depth_strength controls how aggressively that warp follows depth - it's literally the "how much pseudo-3D" dial. In practice this is what makes a 30-frame render look like a 120-frame animation.

How it works

Each call, the node keeps a "previous" and "next" image in an internal interpolator (the same cadence logic Deforum has used forever in the A1111 world), computes depth from the animation's own anim_args settings, computes optical flow with RAFT, and generates the in-between frames via new_standalone_cadence. It also has a first-frame special case: when the current frame index is 0, it uses your first_image as the previous frame so the animation opens from a defined starting point.

Because this node can get heavy, it guards its own VRAM: if free memory drops below ~4 GB it unloads every model before running cadence, which is slow but beats an OOM crash mid-animation.

The inputs and outputs that matter

  • image - the current rendered frame.
  • first_image - the very first frame of the animation, used as the baseline when frame_idx is 0.
  • deforum_frame_data - the DEFORUM_FRAME_DATA from the Iterator; it carries args, anim_args, keys, and frame_idx that the cadence math needs.
  • depth_strength (FLOAT, 0–10, default 1.0) - how hard the depth warp pulls. 0 = flat optical flow, higher = more dramatic parallax.
  • preview (BOOLEAN, default false) - show a live progress preview.
  • hybrid_images (optional IMAGE) - if you're compositing a real video, pass its frames here so cadence interpolates through them.

Outputs:

  • IMAGE - the batch of interpolated frames.
  • IMAGE - the last frame, so the next loop iteration can use it as its baseline.

Installing this pack

Part of Deforum Nodes by XmYx. ComfyUI Manager: search Deforum Nodes, or:

cd ComfyUI/custom_nodes
git clone https://github.com/XmYx/deforum-comfy-nodes

Restart and let install.py do the heavy lift - it installs the deforum-studio backend from GitHub plus a stack of scientific Python (numpy < 2.0), with Python 3.10 as the stated requirement. The depth and RAFT models are downloaded on first use by the backend into the models folder, so the first cadence run is slower than the rest.

Common issues

  • First run downloads models and looks frozen. Depth + RAFT weights are fetched on demand. Give it a minute; subsequent frames are fast.
  • Smearing / ghosting on complex motion. Lower depth_strength - the depth warp is overconfident and the flow is fighting the scene.
  • Slow at high resolution. Depth estimation at 1080p+ is the bottleneck. Render cadence at a modest resolution and upscale after, which is what most people do anyway.
  • OOM. The node tries to offload at <4 GB free, but on a 6 GB card you may still want a lower max_frames/resolution.
Categorydeforum/interpolation

Inputs (6)

NameTypeDefaultDescription
imageIMAGE
first_imageIMAGE
deforum_frame_dataDEFORUM_FRAME_DATA
depth_strengthFLOAT1.000–10
previewBOOLEANfalse
hybrid_imagesoptIMAGE

Outputs (2)

NameTypeDescription
IMAGEIMAGE
IMAGEIMAGE