Nodes/AP Optical Flow + Loop + Inpaint Crop/Stitch/AP Temporal Blend Latents Simple
ComfyUI Node

AP Temporal Blend Latents Simple

The no-dials temporal blend for latent loops

By adampolczynski·Created 6 months ago·Updated 6 months ago· 1
AP Temporal Blend Latents Simple
  • current_latent
  • previous_latent_1
  • previous_latent_2
  • previous_latent_3
  • previous_latent_4
  • mask
  • blended_latent
  • blend_mask
blend_percentage35.0
favor_prev_frame_when_fewfalse

If you've ever stared at a ComfyUI node with five blend modes and eight sliders and just wanted a little bit of the previous frame mixed in, this is your node. AP Temporal Blend Latents Simple is the stripped-down sibling of AP Temporal Blend Latents from the AP_OpticalFlow pack, and its whole job is to take your current latent, mix in some history, and hand you a calmer result. One percentage dial. That's the pitch.

It sits in the same spot as its big brother: inside the pack's latent loop (AP Loop Open (Latent) / AP Loop Close (Latent)), feeding history back in so flicker doesn't accumulate across frames. The "Simple" version just assumes you don't want to think about recency decay curves - you want to know that your output is 35% previous frame, 65% current, and get on with it.

How it works

current_latent is the frame you just made; previous_latent_1 (required) is the frame before it. Wire in previous_latent_2 through previous_latent_4 if you have them - they're averaged together first with a fixed recency weighting (nearest history counts most), and then that average is what gets mixed into the current frame at blend_percentage.

That single control is the whole algorithm: 0 means "use the current frame, nothing changes," 100 means "replace it entirely with history," and the sane operating range is somewhere in the 20–45 zone. Start at 35 and move down if you see motion trails - the classic beginner mistake is cranking the percentage up to smooth aggressive flicker and getting ghosts instead, because the frames genuinely differ. If your content changes a lot between frames, temporal blending has less to work with; that's true for every node in this family.

favor_prev_frame_when_few is worth one line: when you only have two or three frames of history, it boosts the nearest previous frame so a thin temporal window doesn't lose continuity. mask limits the blend to a region - outside the mask, output stays the current frame, which is how you stabilize a subject without smearing the background.

Outputs

blended_latent (LATENT) goes back to the sampler or into AP Loop Close (Latent). blend_mask (MASK) shows where blending happened (all-ones when no mask is connected). Both names match the full node, so swapping one for the other in an existing graph is painless.

When to reach for this vs. the full node

If you want the "kill one artifact with a median" move, mask-limited blending with detail_preservation, or per-pixel similarity weighting - grab AP Temporal Blend Latents. If you want the flicker gone and one slider to remember, grab this one. The honest take: most people who start with the full node end up using it as a two-setting tool anyway.

Install

Same pack either way. ComfyUI Manager, search "AP Optical Flow" and install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/adampolczynski/ComfyUI_AP_OpticalFlow
pip install -r ComfyUI_AP_OpticalFlow/requirements.txt

Restart and you're done - no models to download, just a torchvision>=0.15 dependency. This node itself is pure tensor math, so it runs even if the RAFT nodes aren't cooperating, which makes it a handy flicker patch for any latent pipeline even before you get flow working.

CategoryAP_OpticalFlow

Inputs (8)

NameTypeDefaultDescription
current_latentLATENT
previous_latent_1LATENT
blend_percentageFLOAT35.00–100
favor_prev_frame_when_fewBOOLEANfalse
previous_latent_2optLATENT
previous_latent_3optLATENT
previous_latent_4optLATENT
maskoptMASK

Outputs (2)

NameTypeDescription
blended_latentLATENT
blend_maskMASK