Motion-aware cadence normalization and editable variable retiming for ComfyUI IMAGE batches.
Cadence Retime can smooth uneven generated motion, build reusable source-frame maps, apply creative speed curves, and keep optional audio synchronized. Motion analysis runs directly on the loaded IMAGE batch. It does not require After Effects, an external video decoder, or a CSV round trip.
- Linearize uneven camera or subject motion with in-memory optical-flow analysis.
- Preserve intentional static starts and end settles when requested.
- Build retimes from presets, a source-time graph, or an editable speed graph.
- Sample exact frames from the untouched source and fractional frames from an optional dense RIFE/GMFSS interpolation batch.
- Retime audio with the same picture map using synchronized varispeed.
- Import legacy frame maps from text, JSON, CSV content, or a local CSV path.
- Run without additional Python packages beyond ComfyUI itself.
| Node | Purpose |
|---|---|
Cadence: Normalize Motion |
Analyze and normalize a shot in one node. |
Cadence: Analyze Motion |
Build an inspectable and reusable motion map. |
Cadence: Apply Frame Map |
Apply a legacy or externally supplied frame map. |
Cadence: Retime Preset |
Create a map from common timing presets. |
Cadence: Source-Time Curve |
Draw output-time to source-time mapping directly. |
Cadence: Speed Curve |
Draw playback speed over the duration of the shot. |
Cadence: Apply Retime |
Apply any Cadence time map to an IMAGE batch. |
Cadence: Apply Retime + Audio |
Apply a map to picture and optional audio. |
The nodes appear under Cadence Retime, with Analysis, Maps, and Apply
subcategories.
-
Place this repository in:
ComfyUI/custom_nodes/ComfyUI-Cadence-Retime -
Restart ComfyUI.
-
Search for
Cadence:in the node menu.
No separate requirements install is needed.
Use Cadence: Normalize Motion for the compact workflow:
- Load the untouched video as an IMAGE batch.
- Connect it directly to
source_images. - Optionally send the same source through RIFE or GMFSS at x4 and connect the
result to
motion_interpolated_images. - Send
retimed_imagesto Video Combine and connectoutput_fpsto its frame rate input.
Recommended first pass:
source_fps: source clip frame rateoutput_fps: delivery frame ratestrength:standardprotect_static_edges: off for full-move linearization; enable it only for an intentional static start or end settleminimum_static_frames:3analysis_resolution:256sampling_mode:automotion_multiplier:0for automatic detection, or4for an explicit x4 RIFE/GMFSS branch
x4 interpolation is the normal working setting. Try x8 only when difficult parallax, occlusion, or a large correction still shows temporal stepping.
Use the two-node version when the timing map needs to be inspected, saved, or overridden:
- Connect the untouched IMAGE batch to
Cadence: Analyze Motion. - Connect
cadence_maptoCadence: Apply Retime. - Optionally connect an x4/x8 RIFE or GMFSS batch to
motion_interpolated_images. - Connect
retimed_imagesandoutput_fpsto Video Combine.
Cadence: Analyze Motion also returns CSV text for diagnostics and interchange.
The CSV is optional in a normal ComfyUI graph.
- Motion is measured from the loaded IMAGE batch instead of reopening the source file.
- Dense optical flow estimates screen displacement and builds a monotonic, fractional source-frame map.
gentle,standard, andstrongprogressively approach constant screen travel.- Protected static edges must last at least
minimum_static_frames; brief accidental holds remain part of the analyzed move. preserve_start_secondsandpreserve_end_secondsadd explicit protected regions.analysis_resolutionaffects analysis cost only, not output resolution.
This is apparent-motion normalization, not semantic shot understanding. Cuts, large independent foreground motion, or unrelated moving subjects can influence the measured curve.
All three map builders connect to either Cadence: Apply Retime or
Cadence: Apply Retime + Audio.
Cadence: Retime Preset provides linear, ease-in, ease-out, ease-in/out, and
slow-middle starting curves.
Cadence: Source-Time Curve directly maps output progress on the horizontal
axis to source progress on the vertical axis. Click to add points, drag to shape
the move, and double-click or right-click to remove interior points. The curve
remains monotonic so it cannot accidentally reverse the shot.
Cadence: Speed Curve combines presets with an editable playback-speed graph:
- Horizontal axis: progress through the shot.
- Vertical axis: playback speed from 0.25x to 4x on a logarithmic scale.
- Center line: 1x speed.
- Above center: faster.
- Below center: slower.
With output_frames set to 0, the speed curve determines the resulting
duration. Enable lock_duration to preserve source duration while retaining the
relative speed changes, or set output_frames explicitly.
auto: use the connected dense interpolation batch, otherwise blend source frames linearly.optical-flow batch: require and sample a connected dense RIFE/GMFSS batch.linear frame blend: blend adjacent untouched source frames.nearest frame: select whole source frames without interpolation.
When a dense interpolation batch is connected, exact whole-frame positions come from the untouched source batch. Only fractional positions use the dense batch. This keeps unretimed frames sharp while providing extra temporal samples where the map needs them.
Use Cadence: Apply Retime + Audio when the loaded clip includes audio:
- Connect the source IMAGE batch to
source_images. - Connect a Cadence map to
time_map. - Connect the Load Video audio output to
audio. - Optionally connect an x4/x8 interpolation batch.
- Connect
retimed_images,output_fps, andretimed_audioto Video Combine.
retime (varispeed) follows the picture map and changes pitch with speed.
passthrough leaves the original audio untouched.
Cadence: Apply Frame Map accepts comma- or newline-delimited frame positions,
JSON, pasted Cadence CSV data, a local CSV path, a direct FL Load CSV connection, or a CADENCE_MAP. The legacy internal workflow ID is retained
so existing saved graphs continue to load.
Run the test suite from the repository root:
python -m unittest discover -s tests -v
MIT. See LICENSE.