The_ltX-files / nodes /seconds_to_frames_node.py
marduk191's picture
Rename seconds_to_frames_node.py to nodes/seconds_to_frames_node.py
3062e8d verified
class SecondsToFrames:
"""Convert seconds to frame count for video generation nodes."""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"seconds": ("FLOAT", {
"default": 5.0,
"min": 0.1,
"max": 3600.0,
"step": 0.1,
"display": "number"
}),
"fps": ("INT", {
"default": 24,
"min": 1,
"max": 120,
"step": 1,
"display": "number"
}),
"extra_frame": ("BOOLEAN", {
"default": True,
"label_on": "yes (+1)",
"label_off": "no"
}),
}
}
RETURN_TYPES = ("INT", "FLOAT", "INT",)
RETURN_NAMES = ("number of frames", "fps (float)", "fps (int)",)
FUNCTION = "convert"
CATEGORY = "utils"
def convert(self, seconds, fps, extra_frame):
frames = int(seconds * fps) + (1 if extra_frame else 0)
return (frames, float(fps), fps,)
NODE_CLASS_MAPPINGS = {
"SecondsToFrames": SecondsToFrames
}
NODE_DISPLAY_NAME_MAPPINGS = {
"SecondsToFrames": "Seconds to Frames"
}