Fluid Shot Decoder (Restore Timing)
The other half of ComfyUI's speed-ramp fix
- images
- time_map
- images
Fluid Shot Decoder (Restore Timing) is the cleanup half of the pack's two-node speed-ramp fix. Its partner, Fluid Shot Encoder, inserts flow-warped in-between frames to slow fast motion down to a speed your AI video model can handle; this node takes the AI's output and pulls out exactly the frames that correspond to your original source, restoring the original frame count and the original slow-to-fast pacing.
Think of it as a time-stamp eraser. The Encoder expands your video and keeps a receipt (time_map) of which output frame maps to which source moment. After the sampler does its thing, the Decoder uses that receipt to select only the real frames - the in-between filler is discarded, and what's left is your speed ramp, now AI-processed.
It's part of the MEC/Temporal family in ComfyUI-CustomNodePacks, the ~72-node pack from Code2Collapse (Likhith-24, active on r/comfyui).
How it works
The node takes two inputs:
images- the AI-processed batch (the expanded, normalized output from your sampler).time_map- the TIMEMAP straight from the Fluid Shot Encoder'stime_mapoutput.
Internally it reads original_positions from the map (the indices of the frames that correspond to real source frames) and selects them from the processed batch with index_select. The result is a batch the same length as your original source, with the ramp pacing restored.
The smart bit is its tolerance for frame-count drift. Video models don't always return the exact frame count you fed them - Wan famously pads or trims to a 4n+1 pattern. The Decoder detects a length mismatch, rescales the map proportionally, and clamps, so a trimmed batch degrades to "slightly off timing" instead of a hard error. The source code logs a warning when it has to do this, which is your cue to check your sampler's frame handling if the timing feels off.
The single output is images - the restored-timing batch. If you only need the encoder's expansion for a different reason and want the timing untouched, this node is how you close the loop.
Wiring it
[Speed-ramped video] → Fluid Shot Encoder → normalized_images → [video sampler] → processed
time_map ──────────────────────────────→┐
processed → Fluid Shot Decoder → original timing restored
If the Decoder errors, check the error message it gives you: it refuses to run on anything that isn't a genuine Fluid Shot TIMEMAP, which is a feature - it catches a wiring mistake instead of silently corrupting timing.
Installing it
Ships in ComfyUI-CustomNodePacks. ComfyUI Manager → search "CustomNodePacks", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Code2Collapse/ComfyUI-CustomNodePacks.git
The Decoder itself is pure tensor selection - no cv2 needed for the selection itself, though its sibling Encoder does need opencv-python, which is a required pack dependency anyway. If missing: pip install opencv-python>=4.7.0 scipy>=1.10.0 (install just what's missing; the full requirements.txt can clobber ComfyUI's torch). Restart ComfyUI.
Common issues
- "time_map is not a Fluid Shot TIMEMAP" - you wired a map from somewhere else, or the map got serialized through a node that stripped its structure. Re-wire directly from the Encoder.
- Timing is subtly off after a run - the frame-count rescale kicked in (there'll be a log warning). Check whether your sampler is trimming frames and pad your source to the model's expected count.
- Everything runs but nothing changed - if the source had two or fewer frames, the Encoder emits an identity time map and the Decoder passes the batch through. Nothing to restore because nothing was expanded.
The honest take: on its own this node looks trivial - it's just "select some indices." Its entire value is that it exists as the disciplined counterpart to the Encoder, so the pair forms a complete, correct temporal pipeline instead of a hack you improvise in a text file.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | AI-processed frames (the expanded, normalized batch). | |
| time_map | TIMEMAP | From Fluid Shot Encoder. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |