Nodes/ComfyWarp/ExtractFlowAndMixConsistencyMaps
ComfyUI Node

ExtractFlowAndMixConsistencyMaps

The two-node pipeline in one box

By Sxela·Created 3 years ago·Updated 2 months ago· 49
ExtractFlowAndMixConsistencyMaps
  • current_frame
  • previous_frame
  • Flow
  • Motion edge mask
  • Occlusion mask
  • Border mask
  • Flow preview
  • Mixed consistency map
  • Current frame
  • Previous frame
num_flow_updates20
blur1
dilate2
force_binarytrue
missed_consistency_weight1.00
overshoot_consistency_weight1.00
edges_consistency_weight1.00

If you've looked at a ComfyWarp sample workflow, you've seen the same two steps appear over and over: extract optical flow between two frames, then fold the three consistency masks into one compositing mask. This node is that sequence collapsed into a single box. Same RAFT call, same mask mixing - you just don't have to draw the wires between them yourself, and you get the flow and the mixed mask out of the same run.

That's genuinely worth it, because flow extraction is the expensive part of the pipeline. Splitting it across two nodes means RAFT runs once and produces the masks, then MixConsistencyMaps runs again to combine them. This node does both in one pass, which is fewer GPU round-trips and one less thing to miswire.

Inputs you'll actually touch

  • current_frame / previous_frame - the two source video frames, usually straight from LoadFramePairFromDataset. Same resolution, same order as the pair node gives you.
  • num_flow_updates (default 20) - RAFT refinement passes. Leave it alone unless fast motion is tearing the flow apart.
  • blur (default 1) and dilate (default 2) - clean up the mixed mask. Blur softens it; dilate fattens it so you don't get hard compositing seams exactly on the moving edges.
  • force_binary (default on) - snaps the mixed mask to pure 0/1. This is the classic WarpFusion behavior: a pixel is either "trust the warped style" or "take the current frame," no halfway. Turn it off if you want soft blends.
  • missed_consistency_weight, overshoot_consistency_weight, edges_consistency_weight (all default 1) - how much each of the three masks gets to veto a pixel. Drop a weight to 0 and that mask stops contributing entirely.

Outputs

The node returns eight ports: Flow, Motion edge mask, Occlusion mask, Border mask, Flow preview, Mixed consistency map, plus pass-throughs of Current frame and Previous frame. The pass-throughs are the quietly useful part - they mean this one node can feed the whole flow-blend compositing chain (mixed mask + both frames) without you routing separate wires around.

The Mixed consistency map is the one that matters for output: it's what decides, per pixel, whether to blend the warped stylized frame with the raw current frame (consistent areas) or drop the warped content entirely (inconsistent areas - moving objects, occlusions). That's the "flow blend" deflickering pipeline from the README, and it's what kills the trails and ghosting that raw per-frame diffusion produces.

The tradeoff

You lose a little flexibility versus the two-node version: if you want to inspect each mask before mixing, or reuse one computed flow across several mask mixes, use ExtractOpticalFlow + MixConsistencyMaps separately. But for the default loopback workflow - pair in, mixed mask + warped frame out - this is the node that keeps the graph small and the iteration fast. It's the one I'd reach for first, and it's what most of the newer sample workflows ship with.

CategoryWarpFusion

Inputs (9)

NameTypeDefaultDescription
current_frameIMAGE
previous_frameIMAGE
num_flow_updatesINT205–100
blurINT10–100
dilateINT20–100
force_binaryBOOLEANtrue
missed_consistency_weightFLOAT1.000–1
overshoot_consistency_weightFLOAT1.000–1
edges_consistency_weightFLOAT1.000–1

Outputs (8)

NameTypeDescription
FlowBACKWARD_FLOW
Motion edge maskMASK
Occlusion maskMASK
Border maskMASK
Flow previewIMAGE
Mixed consistency mapMASK
Current frameIMAGE
Previous frameIMAGE