Nodes/fxai-toolkit/凤希AI - 潜空间清除与替换
ComfyUI Node

凤希AI - 潜空间清除与替换

Swap one frame's worth of compressed data for a reference

By fxai666·Created 4 months ago·Updated 4 days ago· 35
凤希AI - 潜空间清除与替换
  • 潜空间序列
  • letter
  • LATENT
帧索引0

A video latent is a compressed stack of frames - every frame of your clip lives inside one tensor, and normally you treat it as an indivisible blob. FxAiLatentClearReplace treats it as editable: it takes a video latent sequence, and replaces the data at one frame position with the first frame of a second latent, then hands the patched latent back. In plain terms: it surgically overwrites one frame's worth of the clip with a reference, without decoding anything to pixels.

The name - "潜空间清除与替换" (latent clear & replace) - is honest about the mechanism: it clears a slot and puts something else in it, all in latent space. If that sounds like a tool for continuity, you've got the pack's thesis right. The README's whole story is segmented long-video generation: generate chunk A, then chunk B must start from where A left off. This node is one of the ways that handoff happens - you carry a reference frame in latent form and inject it into the next segment at the right position, so the model keeps the character, the scene, the lighting.

How it works

It deep-copies the input 潜空间序列, then performs a slice assignment: the frame at 帧索引 in the sequence is replaced by the first frame of the letter latent. Two details in the code are worth knowing.

First, the index can be negative - -1 means "the last frame," counting back from the end. The node clamps the index into range either way, so you can't drive it off the end. Second - and this is the important constraint - the replacement is a direct shape-aligned slice, which means letter must be a latent of the same format and size as the sequence (the code comment says it expects "同格式 LTXV 潜空间", a same-format video latent). If the channel counts or spatial dims don't match, the assignment fails with a shape error. This is not a general-purpose blend; it's a like-for-like slot replacement.

Inputs and outputs

  • 潜空间序列 (LATENT) - the clip to patch.
  • letter (LATENT) - the reference latent; its first frame is what gets written in.
  • 帧索引 (INT, default 0) - which frame slot to replace; negative counts from the end.

Output: LATENT - the patched sequence. The original is untouched (it's a copy).

Installing it

Part of fxai-toolkit (凤希AI, MIT). Install via ComfyUI Manager (search "fxai-toolkit") or:

cd ComfyUI/custom_nodes
git clone https://github.com/fxai666/fxai-toolkit
# restart ComfyUI

No models for the node itself - though it only makes sense in a video-latent pipeline, so you'll need a video model's VAE (the pack targets LTX-Video and MiniMax H3) to have anything to feed it. The pack auto-installs soundfile and psutil at first load. Chinese labels; support via the author's QQ group (775649071) and Bilibili.

Where people get burned

The shape mismatch is the number one failure: feed it a latent from a different VAE or a different resolution and the slice assignment blows up. Make sure both latents come from the same VAE at the same size - that's what "same format" means here, and the shared-VAE-latent-space idea (generate in one model, inject into another) only works when the autoencoders actually match. Also, "replace one frame" is literal: only the first frame of letter is used, so don't expect a reference clip to be spliced in wholesale. And because it works in latent space, what you see when you decode is only as good as the frame you injected - garbage reference in, garbage frame out.

Category凤希AI/工具

Inputs (3)

NameTypeDefaultDescription
潜空间序列LATENT
letterLATENT
帧索引INT0

Outputs (1)

NameTypeDescription
LATENTLATENT