小珠光帧优化
The frame-padding node video people keep rediscovering
- image
- image
- frame_count
- original_count
- front_fill
- back_fill
- first_frame
- last_frame
Every image-to-video user eventually hits the same annoyance: the first frame of your generated clip flickers, or your model needs a specific frame count that your source doesn't have. 小珠光帧优化 (Xiaozhuguang Duplicate First Frame) is the fix for both - it pads your frame batch by duplicating the first frame. The name undersells it; this is the node that makes a source video play nicely with frame-count-sensitive models.
The math it applies is the community-standard one: it pads the front so the total becomes ceil(a/4)*4 + 5 frames, where a is your original count. That's the frame pattern a lot of video pipelines expect - the multiple-of-4 shape plus five is the length many frame-count-sensitive models want to see, and it's the same convention the pack's own video nodes work with. It also reports exactly how much it padded, so you can strip it back out later with the pack's FrameExtract node.
How it works
It takes your IMAGE batch, clones the first frame, and prepends enough copies to hit the target length. front_fill is computed automatically as ceil(batch_count/4)*4 + 5 - batch_count. If you flip multi_fill on and the total still comes up short of 73 frames, it pads the back with copies of the last frame to reach 73 - handy for models with a hard minimum clip length. The node returns everything you need to undo or inspect the operation, not just the padded image.
The inputs that matter
image- your frame batch.multi_fill- enable back-filling with the last frame up to 73 total frames. Off by default.
Outputs: image (the padded batch), frame_count (padded total), original_count, front_fill, back_fill, and standalone first_frame / last_frame (IMAGE). Since v12.11.0 it's cache-friendly: if the input image doesn't change, ComfyUI skips re-running it entirely, so it won't slow down repeated runs.
Install
From the ComfyUI-xiaozhuguang pack - Manager (search "ComfyUI-xiaozhuguang"), or:
cd ComfyUI/custom_nodes/
git clone https://github.com/xiaozhuguang/ComfyUI-xiaozhuguang.git
Restart. No model downloads.
Gotcha
The whole point is that the padding is metadata-aware: keep the front_fill and original_count outputs around if you plan to feed the padded video into the pack's FrameExtract later - that's the exact pair that lets you strip the duplicated frames and get your original sequence back. And remember the padding is duplicated frames, not interpolated ones: a short source gets longer, but it doesn't get smoother. For smoothness you want an actual interpolation node upstream.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| multi_fill | BOOLEAN | false | — |
Outputs (7)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| frame_count | INT | — |
| original_count | INT | — |
| front_fill | INT | — |
| back_fill | INT | — |
| first_frame | IMAGE | — |
| last_frame | IMAGE | — |