RAFT Estimate
Compute optical flow between two frames in ComfyUI
- image_a
- image_b
- RAFT_FLOW
RAFTEstimate measures the motion between two images - the optical flow. Give it frame A and frame B and it computes, for every pixel, how far and which direction that pixel moved from one frame to the next. That flow field is the raw material behind a lot of temporal-consistency and motion-driven tricks in video workflows.
RAFT (Recurrent All-Pairs Field Transforms) is a well-established optical-flow model from computer vision - not something the pack author invented, but the standard modern approach to "where did everything move between these two frames," and it's built into torchvision. This node wraps it so you can get a flow field without leaving ComfyUI. People use optical flow to warp one frame toward the next for smoother animation, to detect and stabilize motion, to drive flow-guided effects, or as an input to more elaborate temporal-consistency setups. If you're doing serious frame-to-frame video work, flow is one of the fundamental signals.
What it actually does
It runs the RAFT model on the pair (image_a, image_b) and outputs a RAFT_FLOW - a per-pixel motion field, not a normal image. Because the flow is a specialized data type, you don't view it directly; you pass it to the pack's RAFTFlowToImage node to render it as a color-coded flow visualization (the classic hue-for-direction, brightness-for-magnitude picture), or feed it into whatever consumes flow downstream.
One practical note: RAFT is a real neural network, so the model weights download automatically the first time you run the node, and the estimate takes a bit of GPU compute per pair - this isn't a free pixel op like flip or levels.
The inputs and outputs that matter
image_a(IMAGE) - the first frame.image_b(IMAGE) - the second frame. Order matters: flow is measured from A to B.
Output is a single RAFT_FLOW. Its natural next stop is RAFTFlowToImage to visualize, or any node that takes a flow field.
How to install it
Pack: jamesWalker55/comfyui-various. ComfyUI Manager - search Various ComfyUI Nodes by Type, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/jamesWalker55/comfyui-various
then restart. The RAFT nodes live in comfyui_raft.py. RAFTEstimate itself relies on torchvision (which any ComfyUI install already has), so it needs no extra pip packages - that's only true for the estimate node. Its sibling RAFTLoadFlowFromEXRChannels additionally needs OpenEXR, but you don't have to install that unless you use the EXR loader.
Common issues & troubleshooting
Frame order and pairing. Flow is directional and per-pair - A to B is not the same as B to A. For a video sequence you compute flow between consecutive frames, so you'll typically be feeding this successive pairs, not a whole batch at once. Feeding two unrelated images gives you a meaningless flow field.
"I plugged it into a preview and got nothing / an error." RAFT_FLOW isn't an IMAGE. You can't wire it straight into a preview or save node - route it through RAFTFlowToImage first to turn the flow into something viewable.
First run is slow and downloads weights. The initial run fetches the RAFT model. If it seems to hang the first time, it's pulling the checkpoint; subsequent runs are quicker. And because it's an actual model doing inference, big frames cost real VRAM and time.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image_a | IMAGE | — | |
| image_b | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| RAFT_FLOW | RAFT_FLOW | — |