Load Last Video (CRT)
Grab the newest video in a folder without typing its name
- IMAGE
- audio
Every loop-style workflow has the same annoyance: you save a video, then want to feed it back in for the next pass, and you have to remember which filename the saver generated this time. Load Last Video kills that whole class of friction. Point it at a folder, it picks the most recent video in it (or the first alphabetically, your choice), decodes it to frames, and hands you both the IMAGE batch and the AUDIO.
It's the video sibling of the pack's Load Last Image and Load Last Latent, and it's built for the same pattern: save-with-path, then load-last, and the pipeline loops on its own output forever without you babysitting filenames.
How it works
Give it an absolute folder_path. It lists files with video extensions (mp4, webm, mkv, mov), sorts them - by file modification date or natural alphabetical order - and picks the first according to that order. invert_order flips it, so "date + inverted" gives you the oldest file instead. Then it opens the file with OpenCV's VideoCapture and decodes frames into a standard ComfyUI IMAGE tensor, plus the audio track.
Three filters control how much you actually pull in:
- frame_load_cap - stop after this many frames (0 = all). Keeps a long clip from flooding your VRAM.
- skip_first_frames - drop the first N frames. Useful when a generated video has a slow intro.
- select_every_nth - only keep every Nth frame. Decimating a 24fps video to 12fps before a regeneration is a common trick to keep the pipeline cheap.
The nice failure mode: if the folder doesn't exist or has no videos, it returns a dummy 512×512 black image with "Dummy" written on it plus silent audio, so downstream nodes don't crash with a None. You get a garbage frame instead of a stack trace - a deliberate trade, and one worth knowing about.
Inputs and outputs
- folder_path - required, absolute path.
- sort_by -
date(default) oralphabetical. - invert_order - reverse the sort.
- frame_load_cap, skip_first_frames, select_every_nth - the frame filters above.
Outputs: IMAGE (frames) and audio (AUDIO). Both feed standard consumers - a sampler's image input, a video encoder's audio.
Installing it
Standard CRT-Nodes install: ComfyUI Manager → CRT-Nodes, or clone + pip install -r requirements.txt, restart. It's under CRT/Load.
Where people get burned
The date sort is "newest file," not "newest matching file" - if the folder also holds unrelated mp4s, the node doesn't know. Keep loop folders single-purpose, or use a subfolder per project. And if your output looks like a black frame with "Dummy" text, that's the fallback talking: check the path and that the folder actually contains a supported extension. Finally, remember frame_load_cap of 0 means "no cap," not "zero frames" - the one input that's counterintuitive.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| folder_path | STRING | — | |
| sort_by | COMBO | date | 2 options: alphabetical, date |
| invert_order | BOOLEAN | false | — |
| frame_load_cap | INT | 00–1000000 | — |
| skip_first_frames | INT | 00–1000000 | — |
| select_every_nth | INT | 11–1000 | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| audio | AUDIO | — |