Nodes/jayhuang-zip-unpack-images/Pick Frames (first/middle/last or index)
ComfyUI Node

Pick Frames (first/middle/last or index)

Grab the first, middle and last frame of a clip — or any single frame by index

By jayhuangaigc·Created 7 months ago·Updated 7 months ago· 3
Pick Frames (first/middle/last or index)
  • frames
  • frames
  • first
  • middle
  • last
frame_index0

When you need one frame out of a video, you usually reach for it three times: the opening shot, something from the middle, and the last frame. That's a thumbnail, a storyboard, a three-point reference for img2img. This node hands you all three on dedicated outputs and throws in a manual frame picker for the cases where the thirds aren't where you want them.

What you get

Feed it an IMAGE batch (from Video Relay in this pack, or any node that outputs a frame sequence) and it returns four outputs:

  • first - the opening frame
  • middle - the frame at total // 2, the middle of the clip
  • last - the final frame
  • frames - this one is where the frame_index input matters (see below)

The first/middle/last outputs are single frames, always. That's the whole appeal: no math, no counting, just three representative moments out of whatever clip came in.

The frame_index quirk you'll want to remember

The frames output changes behavior depending on frame_index (default 0), and the convention is a little unusual:

  • 0 (default) - pass the whole batch through unchanged. The node acts as a passthrough plus a first/middle/last extractor.
  • -1 - output only the last frame.
  • Any positive number - treat it as a 1-based index into the sequence and output that single frame. Frame 1 is the first frame, frame 5 is the fifth, and anything past the end clamps to the last.

So it's not zero-based like most programming: frame_index = 0 means "keep everything," and 1 means "first frame." If you're picking frame 17 of a 100-frame clip and get the whole batch back, you set it to 0 instead of 17 - easy mistake, now you know.

Because this node also accepts a list of batches, each batch in the list gets its own first/middle/last and its own index - so it scales to per-clip keyframe extraction across a whole folder of videos in one graph.

Where it fits

The natural companion is Video Relay one hop upstream (VIDEO → frames), and Save to ZIP one hop downstream if you're packaging keyframes. It's also handy as a quick "what did I actually render" inspector on a long batch. Lightweight, no dependencies beyond the pack itself, nothing to tune but one integer.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/aixqueen/jayhuang-zip-unpack-images.git

Restart ComfyUI (or use ComfyUI Manager → search jayhuang-zip-unpack-images). No models, no extras. Standard pack caveat applies: small single-commit repo from an unknown author, and the source for this one is short enough to skim in a minute.

CategoryJAYHUANG/Zip

Inputs (2)

NameTypeDefaultDescription
framesIMAGE
frame_indexoptINT0-1–1000000

Outputs (4)

NameTypeDescription
framesIMAGE
firstIMAGE
middleIMAGE
lastIMAGE