ComfyUI Node

AD_VideoSeg

Automatic scene-cut detection and splitting

By cardenluo·Created 2 years ago·Updated 22 days ago· 309
AD_VideoSeg
  • video
  • imagelsit
  • status
video_path
detector_mode自适应检测
enable_fade_blacktrue
sensitivity25
black_threshold10
min_scene_seconds0.5
frame_skip1
Seg_moldtrue
target_scene_count5
save_folderoutput/scene_ultimate

This is the mirror image of AD_video_merge in the same pack: instead of stitching clips together, AD_VideoSeg takes one video and cuts it apart automatically wherever the shot changes, then pulls the first and last frame of each resulting segment. If you've got a long source video - reference footage, a scraped clip, a previous generation - and you actually want the individual shots out of it (say, to feed each one separately into an img2img pass, or to build a dataset of clean keyframes), this saves you scrubbing through it by hand in a video editor.

It ships three detection algorithms and you pick one with detector_mode: content detection (basic frame-difference cuts, good for clean hard cuts between shots), adaptive detection (resistant to camera shake and fast motion - this is the default, and the one the author explicitly recommends as most stable), and hash detection (perceptual-hash comparison, more resistant to watermarks and lighting changes than raw pixel diffing). There's also a dedicated enable_fade_black toggle for catching black frames and fade-to-black/fade-in transitions as their own cut points, which content/adaptive detection alone can miss.

The parameters that actually shape your results: sensitivity (1–200, default 25 - lower means more sensitive, so you get finer, more numerous cuts), black_threshold (0–100, default 10 - how dark a frame has to be before it counts as a black/fade frame), min_scene_seconds (0.1–10, default 0.5 - a floor that stops the detector from spitting out tiny fragmentary "scenes" a fraction of a second long), and frame_skip (1–4, default 1 - how many frames to skip between checks; higher is faster to run but coarser, since it can miss quick cuts between the frames it skips). If you'd rather not trust automatic detection to land on a specific number of scenes, Seg_mold (boolean) plus target_scene_count (1–30) let you force the output into a fixed number of segments instead, auto-merging or evenly dividing to hit that target.

Feed it video either as a file path (video_path, required string) or as an upstream VIDEO-typed input (the optional video field) - useful if the source is coming from earlier in your graph rather than sitting on disk already. Output segments get written to save_folder (default output/scene_ultimate). The node itself is flagged is_output_node: true, meaning it writes files as a side effect rather than just passing data downstream. Its two graph outputs are imagelsit - yes, that's the actual output name, typo and all, the extracted first/last frames as IMAGE - and status, a plain-text summary of what happened.

Installing it: ComfyUI Manager, search "ComfyUI-Apt_Preset," or clone it directly - cd ComfyUI/custom_nodes && git clone https://github.com/cardenluo/ComfyUI-Apt_Preset - then run install.bat and restart. Scene detection at this level typically depends on OpenCV, which install.bat should pull in; if the node import-fails, that's the first dependency worth checking by hand.

Troubleshooting: if you're getting way more or fewer scenes than you expect, sensitivity is almost always the dial to move first - content detection especially can over-trigger on camera pans or lighting flicker that aren't real cuts, which is exactly why adaptive detection is the default. If your source has hard-to-catch fades, make sure enable_fade_black is actually on and black_threshold roughly matches how dark your fades actually get (a fade to near-black needs a higher threshold than a fade to pure black). And if you need a predictable output count for a downstream batch process, don't fight the detector's judgment call - flip on Seg_mold and set target_scene_count directly instead.

CategoryApt_Preset/AD

Inputs (11)

NameTypeDefaultDescription
video_pathSTRING
detector_modeCOMBO自适应检测3 options: 内容检测, 自适应检测, 哈希检测
enable_fade_blackBOOLEANtrue
sensitivityFLOAT251–200
black_thresholdFLOAT100–100
min_scene_secondsFLOAT0.50.1–10
frame_skipINT11–4
Seg_moldBOOLEANtrue
target_scene_countINT51–30
save_folderSTRINGoutput/scene_ultimate
videoopt*

Outputs (2)

NameTypeDescription
imagelsitIMAGE
statusSTRING