For the documented ComfyUI Wan conditioning nodes, length is the requested number of real video frames, while the latent tensor’s temporal dimension is calculated as ((length - 1) // 4) + 1. Use real frames to plan the output you want; use the calculated value to understand the latent shape. Check 4*n+1 only when a specific control requires it, such as the manual context-window node. It is not a universal rule for every Wan length input.
Decide which frame count you need
Start with the creative requirement: how many real frames should the sequence contain? If the brief specifies seconds, you also need a target playback frame rate to translate time into frames. The cited node documentation does not define a seconds-to-frames conversion or promise an exported file’s duration, so treat that conversion as your own planning input, not as a node guarantee.
- Identify the exact node and the field being set.
WanImageToVideo,WanCameraImageToVideo,WanFirstLastFrameToVideo, andWanVaceToVideodocument alengthinput for video-sequence frames and a latent length derived from it. - Set
lengthfrom the desired real-frame sequence. For a seconds-based brief, calculate the target frame count using the project’s chosen playback rate, then decide how to handle any fractional result. - Calculate the latent temporal dimension with
((length - 1) // 4) + 1. This is the documented conversion for the listed nodes, not a substitute output duration. - If using
WanContextWindowsManual, check its separatecontext_lengthfield against4*n+1. Do not apply that constraint automatically to a different node’slengthfield. - Read the connected socket’s actual type label when wiring the workflow. Color can be a visual clue, but is not a reliable substitute for the type label.
The WanImageToVideo documentation describes the latent shape and the temporal conversion. The manual context-windows documentation separately states the real-frame requirement for context_length.
Use this planning worksheet
The values below are hypothetical arithmetic examples, not software measurements or guarantees about a generated or exported video. In each row, the first count is the requested real-frame length; the second is the documented latent count. The final column records a separate context-window check, not a test of whether the video length is valid.
| Hypothetical input or observation | Latent count or check | Decision |
|---|---|---|
Requested length = 77 real frames | ((77 - 1) // 4) + 1 = 20 latent frames | Plan the sequence as 77 real frames; use 20 to interpret the latent temporal dimension. |
Requested length = 81 real frames | ((81 - 1) // 4) + 1 = 21 latent frames | Plan the sequence as 81 real frames; do not call 21 the output frame target. |
Proposed context_length = 81 real frames | 81 has the form 4*n+1 | It satisfies the documented format for this context control. |
Proposed context_length = 77 real frames | 77 is not of the form 4*n+1 | Choose a compliant value for this control; do not infer from this that a Wan length of 77 is invalid. |
If duration matters, keep the requested frame count and the playback-rate assumption together in your brief. This worksheet does not establish what a downstream decoder, sampler, or export will report.
Limits and what to do next
The conversion describes the latent temporal dimension for the documented nodes. It does not by itself establish the exact number of decoded frames, the exported file’s duration, or how a particular workflow handles every model or downstream operation. Those require checking the resulting media or consulting documentation for the other components in use.
If your intended real-frame count differs from the value shown in a preview or exported file, first record which stage reports each count: node input, latent shape, or decoded media. Do not “correct” length by entering the latent count; that changes the real-frame request. If the mismatch is specifically a context-window validation issue, adjust context_length to the documented form and inspect the rest of that node’s settings. The context node also has separate context_overlap behavior; detailed window coverage is outside this guide’s scope.
The supplied documentation lists a step of 4 for several length controls, but that listing alone does not establish how every interface accepts off-step values or how the result is rounded. Confirm the actual field behavior in the workflow you use rather than assuming rounding. For WanVaceToVideo, a reference image can also add latent frames and expose a trim_latent value, so its resulting latent sequence has an additional documented detail beyond the basic conversion.
Three quick questions
Does 81 mean 81 latent frames?
No. In the documented Wan conditioning nodes listed above, length is real-frame sequence length; 81 maps to 21 latent temporal positions by the stated formula.
Must every Wan `length` be `4*n+1`?
The cited sources state that requirement for WanContextWindowsManual.context_length. They do not establish it as a universal constraint for every Wan node’s length input.
Should I use latent count to estimate seconds?
No. Use the intended real-frame count and a separately specified playback frame rate for planning. The latent count explains internal temporal shape, not playback duration.
Sources and next step
- WanFirstLastFrameToVideo - ComfyUI Built-in Node Documentation
- WanCameraImageToVideo - ComfyUI Built-in Node Documentation
- WanImageToVideo - ComfyUI Built-in Node Documentation
- WanVaceToVideo - ComfyUI Built-in Node Documentation
- WanContextWindowsManual - ComfyUI Built-in Node Documentation
This guide interprets public documentation and uses explicitly hypothetical acceptance examples, not application tests. Controls and availability can change; verify the cited manual against your installed version.
For work created in Imagild, carry the input requirements and acceptance checklist into the film workspace. The external software controls discussed above belong to their respective products.