Get First & Last Frame (CRT)
The two-frame node behind every Wan extension chain
- images
- first_frame
- last_frame
Every local video model has the same wall to hit eventually: a native context of somewhere around 81 frames, which at 16fps is about five seconds. Nobody's satisfied with five-second clips, and the standard community workaround has been around since Wan 2.1 - generate a clip, grab its last frame, feed that back in as the starting image for the next clip's image-to-video generation, and chain as many of those together as you want. This node is the single, obvious utility that trick needs and doesn't get its own dedicated node in most setups: pulling the first and last frames out of a batch of images.
What it does
You feed it a batch of decoded frames - from a video load node, or straight from a sampler's image output - and it hands back exactly two images: whatever's first in the batch, and whatever's last. That's the entire operation. It doesn't touch anything in between, doesn't interpolate, doesn't resize. It's a pure extraction node.
The reason this matters more than its simplicity suggests: the last-frame-to-first-frame chain is the actual production technique behind long-form AI video on Wan and similar models. It's how people have stitched together 20-30 second continuous shots and, further back, full multi-minute sequences by generating in five-second segments and threading them together. It's also directly relevant if you're doing first-frame/last-frame (FLF) conditioned generation, where a model takes both a starting and an ending image and generates the motion between them - some newer video models explicitly lack this capability and it's called out as a real limitation when they do, which tells you how load-bearing the technique is for anyone doing serious video work locally.
The inputs and outputs that matter
There's exactly one input and two outputs - nothing to configure:
images(IMAGE) - your frame batch.first_frame(IMAGE) - the first image in the batch.last_frame(IMAGE) - the last image in the batch.
Typical wiring: decode your video latent, run it through this node, take last_frame and feed it as the start_image (or equivalent I2V conditioning input) of your next generation's sampler, and keep looping. Or feed both outputs into an FLF-conditioned sampler if your model supports first-frame/last-frame guidance directly.
How to install it
Part of CRT-Nodes. Through ComfyUI Manager, search CRT-Nodes and install. Manually: git clone https://github.com/PGCRT/CRT-Nodes.git into custom_nodes, pip install -r requirements.txt, restart.
Common issues & troubleshooting
first_frame and last_frame come out identical, or the batch looks like one image. Check what's actually feeding the images input - if you're passing a single-image batch (batch size 1) rather than a decoded multi-frame video, both outputs will trivially be the same frame. Make sure you're pulling from a genuine frame sequence, not a still.
Chained generations drift in identity or color over several loops. This is a known, honest limitation of the last-frame-chaining technique itself, not something this node can fix - every hop through decode/re-encode/re-generate introduces a small amount of drift, and it compounds over many links in the chain. It's an accepted tradeoff of the technique, not a bug to chase.
You want more than two frames (a middle frame, or every Nth frame). This node only does first and last by design - for anything more granular you'd need a different frame-sampling node, this one is intentionally narrow.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| first_frame | IMAGE | — |
| last_frame | IMAGE | — |