File size: 1,352 Bytes
58963d7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | 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"
}
|