Nodes/Simple Video Effects/Batch Zoom (Direction + Amount Type)
ComfyUI Node

Batch Zoom (Direction + Amount Type)

Keep one continuous zoom across streamed chunks

By scofano·Created 10 months ago·Updated 20 days ago· 0
Batch Zoom (Direction + Amount Type)
  • images
  • images
  • info
source_frame_count1
directionZoom In
amount_typePixels per Frame
pixels_per_frame1.00
zoom_percentage110
easeLinear
random_seed0
smooth_subpixeltrue

Here's the problem this node exists for. The plain Zoom Sequence node zooms across whatever batch you hand it - start at 0%, end at 100%, one clean pass. But what if your video is too long to process in one batch? You stream it through ComfyUI in chunks: frames 0–100, then 101–200, then 201–300. Run the plain zoom node on each chunk and the zoom restarts for every chunk - you get a sawtooth of resetting push-ins instead of one continuous move.

Batch Zoom is the fix. It's the same zoom logic, but it stores its state in a temporary JSON file between node calls, so the zoom continues from where the previous chunk left off instead of resetting. If you're processing video in chunks for VRAM reasons - which is common with long VHS-loaded clips - this is the node you want.

How it works

The node tracks the last processed global frame index, the running zoom margin, the canvas dimensions, and the easing/mode settings, persisting them across executions. When you feed it the next chunk, it resumes the zoom from the last frame instead of starting over. State clears automatically when it reaches the end - source_frame_count - 1 - so the next video starts fresh. The random modes are handled the way you'd hope: direction = Random and ease = Random roll once per sequence and keep that same choice across all chunks, so your video doesn't change its mind halfway through. With random_seed = 0, a new effective seed is generated at sequence start and held for all chunks.

Inputs and output

  • images - the current batch of frames.
  • source_frame_count - the total number of frames in the whole video. This is the critical one; it tells the node where "end" is so it knows when to reset state. Feed it wrong and your zoom may not know the sequence is over.
  • direction - Zoom In / Zoom Out / Random
  • amount_type - Pixels per Frame / Target Percentage, with pixels_per_frame and zoom_percentage as before (default 110 = 110%)
  • ease - Linear / Ease_In / Ease_Out / Ease_In_Out / Random
  • random_seed - 0 = auto per sequence, > 0 = reproducible
  • smooth_subpixel - continuous subpixel sampling, on by default

Outputs: images (the zoomed chunk) and info (diagnostics). Feed each new chunk back in and keep the workflow alive across batches.

Installing it

Part of the Simple Video Effects pack:

cd ComfyUI/custom_nodes
git clone https://github.com/scofano/ComfyUI-Simple-video-effects
cd ComfyUI-Simple-video-effects
pip install -r requirements.txt

Restart ComfyUI, or install via ComfyUI Manager ("Simple Video Effects"). No models; pure torch image math.

Common issues

The one setting that bites people is source_frame_count. If you feed in the count of the current chunk instead of the whole video, the node resets state early and you get the same restart bug you were trying to escape. State also lives in a temp JSON file, so if you interrupt a run and restart, the saved zoom state may be stale - if a zoom looks wrong on the next run, check that a leftover state file isn't being picked up; clearing it (or letting the run complete) fixes it. And as with the single-batch version, amount_type confusion applies: Target Percentage is usually the sane choice for a whole long clip.

CategorySimple Video Effects/Image Processing

Inputs (9)

NameTypeDefaultDescription
imagesIMAGE
source_frame_countINT11–100000
directionCOMBOZoom In3 options: Zoom In, Zoom Out, Random
amount_typeCOMBOPixels per Frame2 options: Pixels per Frame, Target Percentage
pixels_per_frameFLOAT1.00
zoom_percentageINT110100–10000
easeCOMBOLinear5 options: Linear, Ease_In, Ease_Out, Ease_In_Out, Random
random_seedINT00–2147483647
smooth_subpixelBOOLEANtrue

Outputs (2)

NameTypeDescription
imagesIMAGE
infoSTRING