Skip to content

Repository files navigation

ComfyUI Video Progression

Custom ComfyUI nodes for iterative video storytelling workflows.

This package is built around a simple progression loop:

  • generate a first scene
  • keep the current video state in Infinite_Video*.mp4
  • generate further scenes from the last frame of that video
  • optionally force a custom last frame
  • choose or auto-pick candidate images
  • rebuild the full frame batch for the next video write

Included nodes:

  • Story Scene Switch
  • Whole Video
  • Last Frame Save
  • VP Image Chooser
  • Prompt Traveling
  • Vace Resolution Wizard

Installation

Copy or clone this repository into your ComfyUI custom_nodes folder:

ComfyUI/custom_nodes/Comfyui-Video-Progression

Then:

  1. Restart ComfyUI.
  2. Hard refresh the browser (Ctrl+F5) so the VP Image Chooser frontend loads.

Requirements

These nodes expect a standard ComfyUI environment with:

  • torch
  • numpy
  • Pillow
  • imageio

Video-aware nodes also rely on an imageio backend that can read MP4 files in your environment.

Nodes

Story Scene Switch

Main routing node for first-scene vs further-scene generation.

Inputs:

  • scene_mode: First Scene Generation or Further Generations
  • user_prompt: Yes or No
  • auto_generate: Yes or No
  • force_last_frame: Yes or No
  • image_input: optional IMAGE
  • last_frame_input: optional IMAGE
  • prompt: optional input STRING
  • trigger: optional FLOAT used to force re-execution when needed

Outputs:

  • Image
  • Prompt
  • SceneMode
  • LastFrame
  • ForceFlag
  • AutoFlag

Behavior:

  • auto_generate = Yes
    • forces the node to behave as Further Generations
    • First Scene Generation cannot be auto-generated
    • the SceneMode output reflects the effective mode used by the node
  • First Scene Generation
    • removes temporary last-frame files from the ComfyUI output folder
    • uses image_input as the main image when available
    • if force_last_frame is Yes, last_frame_input is exposed through LastFrame
  • Further Generations
    • reads the last frame from the latest Infinite_Video*.mp4 in the output folder
    • if force_last_frame is Yes and last_frame_input is connected, that image is used instead
    • falls back to image_input only if the video frame cannot be read

Prompt logic:

  • when scene_mode is First Scene Generation, or user_prompt is Yes, the node uses the provided prompt
  • otherwise it loads prompt_further.txt from the output folder
  • the prompt body is not rewritten
  • the node only adds instruction prefix/suffix text

Extra outputs:

  • ForceFlag is a BOOLEAN mirror of force_last_frame
  • AutoFlag is a BOOLEAN mirror of auto_generate
  • LastFrame is only populated when force_last_frame is Yes

Typical uses:

  • connect ForceFlag to LazySwitchKJ
  • connect AutoFlag to VP Image Chooser.auto_pick
  • connect SceneMode to Whole Video.scene_mode

Whole Video

Builds the full frame batch that should be sent to VHS_VideoCombine.

Inputs:

  • scene_mode: string from Story Scene Switch
  • wait_for: IMAGE batch, typically from the VAE decode output you want to turn into video

Outputs:

  • Images
  • count

Behavior:

  • First Scene Generation
    • if a previous Infinite_Video*.mp4 exists, it is archived as Definitive_Infinite_Video_XXX.mp4
    • only the new wait_for frames are returned
  • Further Generations
    • loads frames from the latest Infinite_Video*.mp4
    • deletes that source file
    • appends the new wait_for frames
    • returns the combined batch

Important:

  • this node does not write the final video file itself
  • it prepares frames for VHS_VideoCombine
  • VHS_VideoCombine should then write the new Infinite_Video*.mp4

Last Frame Save

Utility node that writes an input image to:

output/temp_last_frame.png

Inputs:

  • image

Outputs:

  • Image

Behavior:

  • removes the previous temp_last_frame.png if it exists
  • saves the new one
  • passes the image through unchanged

VP Image Chooser

Standalone image chooser extracted into this repository, with its own frontend.

Inputs:

  • mode: Always Pause or Keep Last Selection
  • preview_rescale
  • images: optional IMAGE batch
  • auto_pick: optional BOOLEAN

Outputs:

  • image

Behavior:

  • when auto_pick is True, the node randomly selects one image and returns it immediately
  • when auto_pick is False, the node opens a modal dialog so the user can choose manually
  • Keep Last Selection reuses the previous selection when possible

Notes:

  • this chooser does not depend on Easy Use
  • if you update the chooser frontend, restart ComfyUI and hard refresh the browser

Prompt Traveling

Cycles through up to 20 prompts, one prompt per line.

Inputs:

  • prompts: multiline STRING, one prompt per line
  • prompt_index: visible slider from 1 to 20

Outputs:

  • Prompt

Behavior:

  • blank lines are ignored
  • only the first 20 non-empty lines are used
  • on each run, the node outputs the prompt matching the current slider value
  • after the run, the visible slider is automatically incremented by 1
  • when the next value exceeds the number of available prompt lines, it wraps back to 1

Notes:

  • the node is forced to execute on every queue so the counter can advance even if the text does not change
  • after editing the frontend files, restart ComfyUI and hard refresh the browser

Vace Resolution Wizard

Resizes an image to a fixed target format for video generation.

Inputs:

  • image
  • AUTO
  • format: Square, 16/9, or Vertical
  • crop_instead_of_pad
  • Draft

Outputs:

  • Width
  • Height
  • Resized_Image

Target sizes:

  • Square: 720 x 720
  • 16/9: 960 x 544
  • Vertical: 544 x 720

If Draft is enabled, width and height are halved.

Behavior:

  • if AUTO is enabled, the format is inferred from the input aspect ratio
  • if crop_instead_of_pad is enabled, the image fills the target and is center-cropped
  • otherwise the image is fitted inside the target and padded

Recommended Wiring

Typical progression wiring:

  1. Story Scene Switch
  2. your generation / edit branch
  3. VP Image Chooser
  4. Whole Video
  5. VHS_VideoCombine

Useful control links:

  • Story Scene Switch.AutoFlag -> VP Image Chooser.auto_pick
  • Story Scene Switch.ForceFlag -> LazySwitchKJ.switch
  • Story Scene Switch.SceneMode -> Whole Video.scene_mode
  • decoded frames -> Whole Video.wait_for

Output Folder Conventions

These nodes read and write in the ComfyUI output directory resolved from:

  1. folder_paths.get_output_directory()
  2. /output
  3. ./output

Files used by the workflow:

  • Infinite_Video*.mp4
  • Definitive_Infinite_Video_XXX.mp4
  • prompt_further.txt
  • temp_last_frame.png

Troubleshooting

  • If VP Image Chooser does not open correctly, restart ComfyUI and hard refresh the browser.
  • If further generations use the wrong frame, verify that the latest Infinite_Video*.mp4 exists in the output folder.
  • If prompt progression is wrong, verify that prompt_further.txt exists and is updated before the next run.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages