ComfyUI Node
π Autocrop to Loop
Auto-crops the clip to create a smoother loop: tests crops from the end and scores the seam so it feels like a normal step.
π Autocrop to Loop
- clip_frames
- cropped_clip
- end_crop_frames
- cropped_length
- score
- diagnostics_csv
βmax_end_crop_frames12βΊ
βinclude_first_steptrueβΊ
βinclude_last_steptrueβΊ
βinclude_global_median_stepfalseβΊ
βseam_window_frames2βΊ
βdistance_metricL1βΊ
βscore_in_8bitfalseβΊ
βuse_ssim_similaritytrueβΊ
βuse_exposure_guardtrueβΊ
βuse_flow_guardfalseβΊ
βweight_step_size0.55βΊ
βweight_similarity0.30βΊ
βweight_exposure0.10βΊ
βweight_flow0.05βΊ
βssim_downsample_scales1,2βΊ
βaccelerate_with_gputrueβΊ
βuse_mixed_precisiontrueβΊ
Categoryvideo utils
Inputs (18)
| Name | Type | Default | Description |
|---|---|---|---|
| clip_frames | IMAGE | Your full clip (NHWC, 0β1). Tries every crop from 0..max_end_crop_frames and returns the best loop. | |
| max_end_crop_frames | INT | 120β10000 | Largest crop to test at the END. Higher = more candidates (slower), but potentially better. |
| include_first_step | BOOLEAN | true | Use the first neighbor pair (frame 0β1) as a target step size/similarity. |
| include_last_step | BOOLEAN | true | Use the last neighbor pair inside the KEPT region as a target. |
| include_global_median_step | BOOLEAN | false | Also use the median step across the KEPT region (needs β₯3 frames). Helps ignore outliers. |
| seam_window_frames | INT | 21β6 | Average over multiple aligned pairs across the seam. Larger = more robust. |
| distance_metric | COMBO | L1 | How to measure step size for matching. L1 is usually more forgiving; MSE penalizes big errors more. |
| score_in_8bit | BOOLEAN | false | Score with an 8-bit view (simulate export). Output video still stays float. |
| use_ssim_similarity | BOOLEAN | true | Include SSIM so the seam βlooksβ like a normal neighborβavoid freeze or jump. |
| use_exposure_guard | BOOLEAN | true | Promote smooth brightness across the seam (reduces flicker pops). |
| use_flow_guard | BOOLEAN | false | Encourage consistent motion across the seam (needs OpenCV; slower). |
| weight_step_size | FLOAT | 0.550β1 | Importance of matching step size. Higher = less freeze/jump risk. |
| weight_similarity | FLOAT | 0.300β1 | Importance of visual similarity (SSIM). Helps avoid a frozen-looking seam. |
| weight_exposure | FLOAT | 0.100β1 | Importance of even brightness across the seam. |
| weight_flow | FLOAT | 0.050β1 | Importance of motion continuity across the seam. |
| ssim_downsample_scales | STRING | 1,2 | SSIM scales to average, as a comma list. Example: 1,2 = full-res and half-res. |
| accelerate_with_gpu | BOOLEAN | true | If ON and CUDA is available, run scoring on GPU for a big speedup (same results). |
| use_mixed_precision | BOOLEAN | true | If ON (with GPU), use mixed precision for SSIM/conv math (faster on larger clips). |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| cropped_clip | IMAGE | β |
| end_crop_frames | INT | β |
| cropped_length | INT | β |
| score | FLOAT | β |
| diagnostics_csv | STRING | β |