Nodes/ComfyUI-FFMPEGA/Load Last Frame (FFMPEGA)
ComfyUI Node

Load Last Frame (FFMPEGA)

The other half of the continue-the-scene trick

By AEmotionStudio·Created 8 months ago·Updated a day ago· 16
Load Last Frame (FFMPEGA)
  • fallback_image
  • mask
  • trigger
  • images
  • mask
  • image_path
  • width
  • height
  • frame_count
slot_namedefault
refresh_modeauto
frame_count1
offset_from_end0
on_missingfallback
source_folder
filename_filter
enable_resizefalse
resize_width512
resize_height512
upscale_methodnearest-exact
keep_proportionresize
pad_color0, 0, 0
crop_positioncenter
divisible_by2
resize_devicecpu

Short clips are the honest constraint of local video generation. Wan 2.2 gives you 81 frames - about five seconds - and if you want thirty seconds of a shot, you get there by chaining generations, handing each one the frame the previous one ended on. Load Last Frame is the read side of that handoff. It picks up whatever Save Last Frame put in a named slot so a later queue run can start where the last one finished.

Worth saying up front, because it's the most common mistake with this pair: if both nodes live in the same workflow, don't use this one. Use Save Last Frame's last_frame output directly. Two unconnected nodes have no guaranteed execution order, and ComfyUI decides caching before execution starts, so this node would hand your sampler the previous run's frame. This node exists for the case where the save happened in an earlier run - a continuation session, not a graph-internal wire.

The four required settings

  • slot_name - must match Save Last Frame's slot name exactly. Discovery is deterministic: the slot directory is derived from the name and files inside carry fixed zero-padded names, so there's no mtime race against everything else in your output folder.
  • refresh_mode - auto reloads whenever the slot's contents change; manual only re-runs when an input changes. Leave it on auto for a chain you're actively iterating on. Under the hood this is an IS_CHANGED method that hashes the slot directory, so auto is what makes a new frame actually invalidate the cached node.
  • frame_count - how many of the slot's trailing frames to load, capped at whatever the slot actually holds.
  • offset_from_end - skip N frames at the end, mirroring the save side's widget of the same name.

Optional bits worth knowing

on_missing (default fallback) decides what happens when the slot is empty - which is always the case on the first run of a chain. fallback uses the fallback_image input, empty returns a black frame, error stops the run with a message. Wire your original start image into fallback_image and run 1 and run N are literally the same graph with no rewiring; skip it and you get a black frame that silently poisons the generation instead of failing loudly.

source_folder abandons the slot convention entirely and reads an arbitrary folder, picking files by modification time since the naming convention can't be assumed there. filename_filter narrows that to files starting with a prefix. trigger is an ordering hint - wire any Save Last Frame output into it to force that node to run first, though the tooltip is honest that this fixes ordering and not caching, so a just-written frame may still need a re-queue. There's also a mask pass-through, and a collapsed block of resize widgets (enable_resize, resize_width, resize_height, upscale_method, keep_proportion, pad_color, crop_position, divisible_by, resize_device) that stays tucked away until you turn it on. If you're feeding a 720p tail into a model that wants multiples of 32, that block is where you fix it - divisible_by does the rounding.

Outputs: images (oldest first - feed the last one into your i2v model), mask (a solid white mask matching the frames), image_path, width, height, and frame_count, which returns 0 when the slot was empty and is your fastest way to tell "empty slot" from "model problem".

Install

ComfyUI Manager → search ComfyUI-FFMPEGA → Install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/AEmotionStudio/ComfyUI-FFMPEGA.git
pip install -r ComfyUI-FFMPEGA/requirements.txt

Restart. Nothing to download - it's reading PNGs off disk, so the only external requirement is FFMPEG on PATH (which this pack assumes for everything). Like Save Last Frame, it renders a thumbnail strip of the slot inline so you can see which frame you're continuing from before you queue.

Where people get burned

The black frame. First run of a chain, empty slot, on_missing left on fallback and fallback_image unconnected. You get a black start frame and a five-second clip of nothing much, with no error anywhere. Connect the fallback image before you run, every time.

Sequential chaining compresses quality. The community's long-form approach for a reason: each continuation is one generation removed from the original, and degradation accumulates until faces drift. The alternative that avoids it is generating several clips from the same source and using their frames as keyframes, so nothing is more than one hop away. SVI-style extension LoRAs are the other live path on plain Wan 2.2.

CategoryFFMPEGA

Inputs (19)

NameTypeDefaultDescription
slot_nameSTRINGdefaultSlot to read from — must match the slot_name on Save Last Frame.
refresh_modeCOMBOautoauto: reload whenever the slot's contents change. manual: only re-run when an input changes.
frame_countINT11–64How many of the slot's trailing frames to load. Capped at whatever the slot actually holds.
offset_from_endINT00–64Skip this many frames at the end of the slot. Only useful when the slot holds several frames.
on_missingoptCOMBOfallbackWhat to do when the slot is empty — which is always the case on the first run of a chain. fallback: use the fallback_image input (a black frame if none is connected). empty: return a black frame. error: stop the run with a clear message.
fallback_imageoptIMAGEUsed when the slot is empty. Wire your original start image here so run 1 and run N of a chain are the same graph with no rewiring.
source_folderoptSTRINGRead from an arbitrary folder instead of the slot. Files are picked by modification time here, since the naming convention can't be assumed.
filename_filteroptSTRINGOnly consider files starting with this prefix.
maskoptMASKOptional upstream MASK pass-through. When connected, this mask is forwarded instead of the generated one.
triggeropt*Ordering hint. Wire any Save Last Frame output in to force that node to run first. The value is ignored. Note this fixes ordering but not caching — a freshly written frame may still need a re-queue.
enable_resizeoptBOOLEANfalseResize the output image (and mask) before returning.
resize_widthoptINT5120–8192Target width. 0 = derive from aspect ratio.
resize_heightoptINT5120–8192Target height. 0 = derive from aspect ratio.
upscale_methodoptCOMBOnearest-exactInterpolation method used when scaling.
keep_proportionoptCOMBOresizestretch: ignore aspect ratio. resize: fit inside w/h. pad: fit then pad to w/h. crop: crop to aspect then scale.
pad_coloroptSTRING0, 0, 0Padding color as 'R, G, B' (0-255). Used by pad mode.
crop_positionoptCOMBOcenterAnchor for crop/pad placement.
divisible_byoptINT20–512Round final dimensions down to a multiple of this (0/1 = off).
resize_deviceoptCOMBOcpuCompute device for resizing. GPU does not support lanczos.

Outputs (6)

NameTypeDescription
imagesIMAGEThe saved frame(s), oldest first. Feed the last one into an i2v model to continue the scene.
maskMASKSolid white mask matching the loaded frames.
image_pathSTRINGAbsolute path of the newest loaded frame.
widthINTWidth of the loaded frames.
heightINTHeight of the loaded frames.
frame_countINTHow many frames were loaded. 0 means the slot was empty.