Repository navigation
Description
What I'm trying to do
I'm building long videos by chaining clips through sd-server: each clip starts from the last frame of the one before (init_image), and every few clips I re-anchor with end_image. It works, but a single frame carries no motion. At each seam the next clip can pick a different speed or direction, and the small jumps add up over many hops.
Both Wan2.2 S2V and LTX-2.3 were designed to continue from more than one frame. As far as I can tell, sd.cpp only gives each of them a single image today. I'd like to ask whether conditioning on several leading frames (or a short clip) could be supported.
Wan2.2 S2V: motion frames
The reference implementation makes long videos clip by clip and feeds the tail of the previous clip back in as motion latents. In wan/configs/wan_s2v_14B.py the 14B model runs with enable_framepack = True, motion_frames = 73 and drop_first_motion = True. In wan/modules/s2v/model_s2v.py, inject_motion() appends the packed motion tokens to the sequence and marks them with 2 in mask_input, so they pick up row 2 of trainable_cond_mask (an nn.Embedding(3, dim)).
In sd.cpp the weight is loaded with all three rows (wan.hpp#L554-L557), but only rows 0 (video tokens) and 1 (reference tokens) are used (wan.hpp#L727-L738). I couldn't find the FramePack motioner or any motion-latent input. For S2V, init_image becomes the identity reference (s2v_reference in video_wan.dgl), not a frame the output keeps. So chaining by last frame works less well with S2V than with the I2V models.
Supporting motion latents would make S2V usable for long, continuous clips, which is the main way it's meant to be used.
LTX-2.3: several leading frames
The LTX path already places the start frame as a latent slice with a denoise mask (video_ltx.dgl#L27-L30): replace_slice at index 0 and index_fill with 1 - strength. With the LTX VAE's 1 + 8k frame layout, a short clip of 1 + 8k frames encodes to k + 1 latent frames. Those could go in the same way: a longer slice, with the mask set over the same range. That's how the LTX pipelines extend a video. Right now first_frame_pixels is always a single frame.
Possible API
One way to expose this, though I'm not attached to the names:
- A video input for the leading frames, e.g.
init_video(frames or a clip), next toinit_image, with the number of frames to keep. LTX would use it as leading latents. S2V would use it as motion latents. - A feature flag in the recipe features (alongside
init_image,end_image,control_frames), so clients can tell whether a loaded model takes it and fall back toinit_imageotherwise.
Now that DGL is in (#2396), this might be mostly a template change for LTX. S2V would also need the motioner weights and inject_motion on the model side.
Notes
- Wan2.2 I2V A14B and VACE don't seem to cover this either: VACE
control_framesget an all-ones mask invideo_wan.dgl, so they guide structure rather than being kept. - I can help test on CUDA (RTX A4000) and ROCm (R9700) if that's useful.
Activity
leejet commentedon Nov 22, 2026
You can implement the LTX workflow you want by writing your own DGL script. That's one of the main purposes of DGL — allowing users to define custom workflows without modifying sd.cpp.
sd-server also provides an API for executing DGL scripts directly.