Nodes/ComfyUI-UtilsCollection/Sample Video Frames (Images)
ComfyUI Node

Sample Video Frames (Images)

The frame-picker built for LLM video conditioning

By silveroxides·Created 2 months ago·Updated about 7 hours ago· 24
Sample Video Frames (Images)
  • video
  • image batch
  • images
  • timestamps
  • timestamps text
  • timeline text
  • video runtime
  • structured timeline text
sampling_strategycodec keyframes
maximum_frames16
focus_areas0
focus_one0.50
focus_two0.50
focus_three0.50
include_zero_timetrue
minimum_spacing_seconds0.25
keyframe_stride1
timestamp_format00.000s
timeline_styleH3 alignment prefix
index_offset0

You've got a video, and you want a handful of its frames as images - but not just any frames, and not just as an image batch: you want them aligned to timestamps, as a list, with the <Picture N> references formatted for pasting straight into a video-model prompt. That's the oddly specific job this node does, and it does it better than the generic "extract frames" loops most workflows used to hack together.

What it does

Feed it a Core VIDEO input and it samples presentation-timestamp-aligned frames, then hands you the same frames in several forms at once: an image batch (IMAGE, chronological, good for direct sampling), an images list (IMAGE, one entry per frame, independently mappable), and a stack of text outputs - timestamps, timestamps text, timeline text, and structured timeline text - all formatted consistently and ready to drop into a prompt.

The default timeline_style is "H3 alignment prefix," which is a tell: this node was built for the pack's MiniMax H3 / Qwen video-reference workflows, where the prompt references images as <Picture N> entries with timestamps. The index_offset input exists so you can reserve the first indices for earlier reference images and let this node's frames start later in the numbering. If you're not on an H3 workflow, the "timestamps only" or "zero-based indexed" styles give you the same data in plainer form.

The settings that matter

  • sampling_strategy - codec keyframes (default) keeps only actual codec keyframes (low redundancy); uniform PTS spaces frames evenly across the video; focused PTS groups frames around specific moments.
  • focus_areas (0–3) + focus_one/two/three (0–1 each) - focused mode splits the video into up to three parts and each focus value says where in that part the frames cluster (0 = early, 0.5 = balanced, 1 = late). Want the interesting motion at 70% through the clip? Set focus to 0.7.
  • maximum_frames (default 16; 0 = keep every eligible frame) and minimum_spacing_seconds (default 0.25) - together they cap output and enforce a floor between frames, so you don't get a burst of near-duplicate frames.
  • include_zero_time (default on) normalizes the first visible frame to position 0 - the timestamp reference everyone expects.
  • keyframe_stride - keyframe mode only; keep every Nth keyframe before spacing and count limiting.
  • timestamp_format and timeline_style - cosmetic, but they set exactly how the text outputs read.

Outputs you'll actually wire: image batch into a sampler, the timeline text / structured timeline text into a prompt, and video runtime when you need the active duration (including any trim) in seconds.

Install

Part of ComfyUI-UtilsCollection:

cd ComfyUI/custom_nodes
git clone https://github.com/silveroxides/ComfyUI-UtilsCollection

Restart, or install via ComfyUI Manager (search "UtilsCollection"). No model downloads - this is pure frame extraction. Requires Core's VIDEO type, which means a reasonably recent ComfyUI.

Gotchas

Keyframe mode depends on the codec actually having keyframes; highly compressed web sources may yield fewer than you expect - bump maximum_frames or switch to uniform PTS if your picks look sparse. And remember the pack-level housekeeping: UtilsCollection re-registers node IDs from several older packs, so accept ComfyUI's "replace node?" prompt when loading older workflows and you'll be on the current implementation.

Categoryimage/video

Inputs (13)

NameTypeDefaultDescription
videoVIDEOCore VIDEO input to sample.
sampling_strategyCOMBOcodec keyframesChoose which video frames to keep. Focused PTS groups frames around the focus settings.
maximum_framesINT16Maximum total output count, including the zero-time frame. 0 returns every frame eligible after spacing and stride.
focus_areasINT00–3Focused PTS only. How many parts to split the video into. 0 spaces frames evenly.
focus_oneFLOAT0.500–1Focused PTS only. Where frames group in the first part. 0 is early, 0.5 is balanced, 1 is late.
focus_twoFLOAT0.500–1Focused PTS only. Where frames group in the second part. 0 is early, 0.5 is balanced, 1 is late.
focus_threeFLOAT0.500–1Focused PTS only. Where frames group in the third part. 0 is early, 0.5 is balanced, 1 is late.
include_zero_timeBOOLEANtruePlace the first visible frame at output position 0 and normalize its presentation timestamp to zero.
minimum_spacing_secondsFLOAT0.25Minimum presentation-time separation between selected frames.
keyframe_strideINT1For codec keyframes only, retain every Nth raw codec keyframe before spacing and count limiting.
timestamp_formatCOMBO00.000sFormatting reused verbatim by every text output.
timeline_styleCOMBOH3 alignment prefixScalar timeline text: full H3 alignment prefix, compact H3 <Picture N>, zero-based indexed, or timestamps only.
index_offsetINT0Adds this value to every <Picture N> reference so earlier reference images can occupy the first indices.

Outputs (7)

NameTypeDescription
image batchIMAGESelected frames as one chronological IMAGE batch.
imagesIMAGESelected frames as aligned single-image list entries.
timestampsSTRINGFormatted timestamps aligned with the image list.
timestamps textSTRINGAll formatted timestamps joined into one comma-and-space-separated string.
timeline textSTRINGOne concatenation-ready timeline string.
video runtimeFLOATFull active VIDEO duration in seconds, including the active trim.
structured timeline textSTRINGVideo duration, segment count, and chronological <Picture N> timestamp references in one sentence.