LRW Latent Keyframe Picker
Grab one keyframe from the pile (without breaking WAN's decoder)
- keyframe_latents
- latent
- info
LRW_WanGeodesicKeyframes hands you a stack of intermediate keyframes in one big latent tensor. Latent Keyframe Picker's job is to pull exactly one of them out. Sounds trivial - and honestly it mostly is - but the reason it exists as a whole node is a WAN-specific trap: WAN's VAEDecode expects a 5D latent (B, C, T, H, W), and a naively picked 4D frame makes it crash with IndexError: shape[4] out of range. This node exists so you don't have to remember that.
What you set
keyframe_latents- the stacked output fromLRW_WanGeodesicKeyframes. Layout(B×K, C, H, W)(or 5D).batch_size(default 1, tooltip: "Original latent batch size. Usually 1.") - the batch the keyframes were generated with. This is how the node knows thatkeyframe_latentscontainsKkeyframes, not a single giant batch.keyframe_index(default 0, tooltip: "0 = first intermediate keyframe.") - which one to pick.output_layout- the interesting one:wan_5d(default) - adds theT=1dimension WAN VAEDecode needs. Use this before WAN decode, always.image_4d- forces(B, C, H, W)for image-model use.keep- returns whatever shape it found, if you know what you're doing.
Outputs are the picked latent plus an info string that confirms the detected keyframe count, the index actually selected (it clamps out-of-range requests to the last keyframe rather than erroring), and the before/after shapes.
Two small gotchas
First, if total % batch_size != 0 the node raises a clear error rather than guessing - so if you changed n_keyframes upstream and forgot to update batch_size, the error message tells you exactly that. Second, the clamp: an out-of-range keyframe_index silently gives you the last keyframe, so if your blend seems stuck on the final keyframe, check that number.
Where it fits
The pack's recommended WAN pipeline uses this as the bridge between the keyframe generator and the guide blend: LRW_WanGeodesicKeyframes → LRW_LatentKeyframePicker (pick the middle) → LRW_WanLatentGuideBlend. Alternatively, decode the picked frame with WAN VAEDecode to actually look at your keyframe - the wan_5d layout exists precisely so that works. It's the image-model counterpart of LRW_LatentBlend, which does the same select-a-frame job for geodesic interpolation paths without the 5D handling.
Install
Part of comfyui-lrw-nodes by lajjadred. Search the pack in ComfyUI Manager, or:
cd ComfyUI/custom_nodes
git clone https://github.com/lajjadred/comfyui-lrw-nodes
cd comfyui-lrw-nodes
pip install -r requirements.txt
Restart ComfyUI. Real deps: latent-riemannian-world >= 0.3.0, torch >= 2.4, Python 3.12+. Funny enough, this node was the actual subject of the pack's early import bug - the keyframe picker was briefly imported from the wrong module, which made the whole pack fail to load and show "UNKNOWN" nodes. That's fixed upstream; if you installed early, git pull and a full restart, and keep one copy of the pack in custom_nodes. License is BSL-1.1.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| keyframe_latents | LATENT | — | |
| batch_size | INT | 11–64 | Original latent batch size. Usually 1. |
| keyframe_index | INT | 00–63 | Which keyframe to pick. 0 = first intermediate keyframe. |
| output_layout | COMBO | wan_5d | Use wan_5d before WAN VAEDecode. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | — |
| info | STRING | — |