Nodes/lf-nodes/Select loop segment
ComfyUI Node

Select loop segment

Pick the best self-closing loop out of a shot by seam versus motion, then resample it to a fixed frame count for a sprite atlas.

By lucafoscili·Created 2 years ago·Updated 2 days ago· 36
Select loop segment
  • image
  • ui_widget
  • image
  • receipt
  • image_list
◄source_fps24.00►
◄target_count24►
◄min_period_frames12►
◄max_period_frames96►
◄motion_floor0.60►
◄analysis_max_edge96►
Category✨ LF Nodes/Image

Inputs (8)

NameTypeDefaultDescription
imageIMAGEOrdered frames of one shot (for example a decoded video). The best self-closing segment is chosen and resampled to target_count frames, excluding the final endpoint so the loop closes.
source_fpsFLOAT24.000.01–1000Frame rate of the source frames; derives cycle seconds.
target_countINT241–4096Frames in the output loop. Periods shorter than this are ignored.
min_period_framesINT122–4096Shortest cycle to consider, in source frames.
max_period_framesINT962–4096Longest cycle to consider, in source frames (clamped to the shot).
motion_floorFLOAT0.600–4Minimum mean inter-frame motion inside a candidate, as a multiple of the shot's median step. Keeps frozen stretches from winning.
analysis_max_edgeoptINT968–1024Longest edge of the grey analysis copies.
ui_widgetoptLF_MASONRY[object Object]—

Outputs (3)

NameTypeDescription
imageIMAGESampled loop frames as one batch, in playback order; pixels are unchanged.
receiptJSONLoop-selection receipt: chosen start/period, seam and motion scores, sampled indices.
image_listIMAGEThe same sampled frames as an authoritative list.