KJNodes/miscgenerated

Scale Batch Prompt Schedule(ScaleBatchPromptSchedule)

This node identifies keyframes defined in the format `'frame number':'prompt'` by parsing the input string.

Scale Batch Prompt Schedule

STRING
input_str
0:(0.0), 7:(1.0), 15:(0.0)
old_frame_count
1
new_frame_count
1
KJNodes

The Scale Batch Prompt Schedule node parses the input string to identify keyframes defined in the format frame_number:(value) (e.g., 0:(0.0)). Multiple keyframes are separated by commas and line breaks.

The Scale Batch Prompt Schedule node is used to adjust a prompt schedule generated by Fizz's BatchPromptSchedule node to fit a new total frame count. Its core function is to remap the positions of keyframes within the schedule, thereby adapting the original animation prompt plan to video sequences of different lengths without altering the prompt content.

Node Function

This node parses the input string to identify keyframes defined in the format frame_number:(value) (e.g., 0:(0.0), 7:(1.0), 15:(0.0)). It then calculates a scaling factor based on the old and new total frame counts and uses this to recalculate the position of each keyframe on the new timeline. Finally, it outputs a string in the same format but with updated frame numbers for use by subsequent nodes.

Node Parameter Description - Scale Batch Prompt Schedule

Control Parameters (Parameters)

Parameter NameData TypeRequiredDefault ValueRange/OptionsDescription
input_strSTRINGYes0:(0.0),\n7:(1.0),\n15:(0.0)\n-input_str (Input Parameter): The original prompt schedule string to be scaled. The format must be frame_number:(value) with keyframes separated by commas and newlines (e.g., 0:(0.0),\n7:(1.0),\n15:(0.0)\n).
old_frame_countINTYes11 - 4096 (Step: 1)old_frame_count (Input Parameter): The total frame count corresponding to the original prompt schedule. The value range is 1 to 4096.
new_frame_countINTYes11 - 4096 (Step: 1)new_frame_count (Input Parameter): The new total frame count to which the prompt schedule should be scaled. The value range is 1 to 4096.

Output

Parameter NameData TypeDescription
STRINGSTRINGSTRING (Output Parameter): The output is the scaled new prompt schedule string.

Use Cases

This node is very useful when creating animated videos and needing to adjust the total frame count. For example, if you initially designed a prompt variation plan for a 30-frame animation but later decided to extend the animation to 60 frames, you can use this node to smoothly scale the original 30-frame plan to 60 frames without manually recalculating and entering the position of each keyframe.

The Scale Batch Prompt Schedule node is from the ComfyUI-KJNodes node package.

Comments

Sign in with GitHub to join the discussion.

Loading comments…