WAN Unloop Bridge
Putting the Loop Back Together, Frame-Exact
- raw_frames
- inpainted_frames
- frames
This is the second half of a two-node pair, and on its own it's useless. WAN Loop Bridge cuts a masked gap into your animation and hands WAN a valid sampling segment; you sample it; WAN Unloop Bridge throws away all the scaffolding and returns your original footage with the newly generated frames spliced into the seam.
If you arrived here first: the loop you're trying to fix is the one where image-to-video gives you lovely motion and then a visible jump at the wrap, and first-last-frame gives you a clean wrap and no motion. Go read the Loop Bridge node, then come back. This node's job is bookkeeping.
What it's actually solving
A masked WAN sampling pass doesn't return your insertion frames. It returns the whole segment - padding frames, context frames, generated frames, in the order the bridge packed them. Some of those frames are real footage you already had, some are black-masked scaffolding that exists only to satisfy the 1 + 4n length rule, and some are the ones you actually want.
Hand-slicing that with a batch-index node is possible and miserable. This node does it from the metadata the bridge emitted, so the numbers can't drift out of sync with how the segment was built.
How it works
Three inputs, and the metadata is the authority.
raw_frames- the untouched source animation, straight from the Loop Bridge'sraw_framesoutput.inpainted_frames- the complete sampled segment, all of it, padding and context included.metadata- the Loop Bridge'smetadataoutput. It's aforceInputstring: you have to wire it, you can't paste it in.
It parses that JSON, checks the format field, confirms every field it needs is present, then validates your batches against it. The raw batch must have exactly the frame count the metadata recorded. The sampled batch must match the recorded segment length. Heights, widths and channel counts must agree between the two. Only then does it slice: keep the raw frames between the recorded begin and end boundaries, pull insert_frames generated frames starting at the recorded segment offset, drop them in at the insertion index, and return the lot.
One output: frames - the surviving raw footage with only the generated seam frames inserted. No context duplication, no black frames, no padding. Ready for a video save or the next pass.
Why the strictness is a feature
All that fussiness buys you something: the alternative is silently splicing context frames into your animation and shipping a stutter with no error to explain it.
The errors are specific enough to act on:
metadata is not valid WAN Loop Bridge JSON- you wired something that isn't the metadata output.metadata is not recognized WAN Loop Bridge metadata- right shape, wrong source (a stale string from a different graph, typically).WAN Unloop Bridge requires the untouched raw batch: metadata expects N, received M- your raw batch got trimmed, resampled or re-loaded somewhere in between.WAN Unloop Bridge received the wrong sampled segment length- the sampler gave you back a different number of frames, or you cut the segment down before wiring it.
Install
Manager → search Link Comfy Nodes → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/Mister-Link/link-comfy-nodes
cd link-comfy-nodes
pip install -r requirements.txt
This is a single-author personal pack with a one-line README ("use at your own risk - I change how nodes behave without warning") and no published examples. The whole pair depends on the metadata format staying stable between the two nodes, which is exactly what that warning tells you not to assume: after an update, re-run the pair end to end instead of reusing a cached bridge result.
Practical notes
Wire raw_frames directly. Any node between the two bridges that could reorder or clip a batch - a frame shifter, a trimmer, an image loader that re-reads from disk - will trip the count check. If you need to work on the raw frames, do it before the bridge.
Don't judge the loop in the sampler preview. The sampled segment looks wrong by design: black padding at the ends, your own footage in the middle, generated frames sandwiched between. That's the correct output. The loop only exists after this node.
Keep the sampling batch intact. Passing only the white-masked frames to the Unloop node, in an attempt to "just keep the good ones", is the other common mistake - it fails the length validation, for good reason.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| raw_frames | IMAGE | Untouched source animation passed through WAN Loop Bridge. | |
| inpainted_frames | IMAGE | Complete WAN-valid bridge segment after sampling. | |
| metadata | STRING | Metadata output from WAN Loop Bridge. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| frames | IMAGE | Surviving raw frames with only the generated seam frames inserted. |