Download ltx_duration_node.py from Smite79/LTX-2.3-RTX5060Ti: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/Smite79/LTX-2.3-RTX5060Ti/resolve/main/ltx_duration_node.py
- Command line
-
hf download hf://Smite79/LTX-2.3-RTX5060Ti/ltx_duration_node.py
-
curl -L -o ltx_duration_node.py https://huggingface.co/Smite79/LTX-2.3-RTX5060Ti/resolve/main/ltx_duration_node.py
1.37 kB
| # LTX Duration -> Frames | |
| # Drop this file into ComfyUI/custom_nodes/ and restart ComfyUI. | |
| # Converts a duration in seconds to a valid LTX 2.3 frame count, | |
| # snapped to 8n+1 (latent temporal compression requirement). No duration cap. | |
| # Outputs fps as both INT and FLOAT so one node drives every consumer. | |
| class LTXDurationToFrames: | |
| def INPUT_TYPES(cls): | |
| return { | |
| "required": { | |
| "duration_seconds": ("FLOAT", {"default": 10.0, "min": 0.5, "max": 120.0, "step": 0.1}), | |
| "fps": ("INT", {"default": 25, "min": 1, "max": 60}), | |
| } | |
| } | |
| RETURN_TYPES = ("INT", "INT", "FLOAT", "FLOAT") | |
| RETURN_NAMES = ("frames", "fps_int", "fps_float", "actual_seconds") | |
| FUNCTION = "calc" | |
| CATEGORY = "LTX" | |
| def calc(self, duration_seconds, fps): | |
| raw = duration_seconds * fps | |
| n = round((raw - 1) / 8.0) | |
| frames = int(8 * n + 1) | |
| if frames < 9: | |
| frames = 9 | |
| actual = frames / float(fps) | |
| print("[LTXDurationToFrames] %.1fs @ %dfps -> %d frames (%.2fs actual)" | |
| % (duration_seconds, fps, frames, actual)) | |
| return (frames, int(fps), float(fps), actual) | |
| NODE_CLASS_MAPPINGS = {"LTXDurationToFrames": LTXDurationToFrames} | |
| NODE_DISPLAY_NAME_MAPPINGS = {"LTXDurationToFrames": "LTX Duration to Frames (seconds)"} | |