Nodes/comfyui-timesaver/TS Video Loader
ComfyUI Node

TS Video Loader

Load a video: frames, audio and a compact video_info bundle. Trim the clip visually on the timeline inside the node, resample the frame rate and resize while decoding.

By AlexYez·Created 2 years ago·Updated 3 days ago· 11
TS Video Loader
    • images
    • audio
    • video_info
    • video
    source_path
    start_seconds0.000
    end_seconds-1.000
    frame_rate0.000
    max_frames0
    longer_side0
    shorter_side0
    divisible_by1
    frame_step1
    resize_filterarea
    when_too_largestop
    CategoryTS/Video

    Inputs (11)

    NameTypeDefaultDescription
    source_pathSTRINGVideo file. Pick or drop one in the node's own interface; a path to a file on the ComfyUI machine works too.
    start_secondsFLOAT0.0000–1000000Start of the clip. Drag the left handle on the timeline.
    end_secondsFLOAT-1.000-1–1000000End of the clip. -1 means "until the end of the file". Drag the right handle on the timeline.
    frame_rateFLOAT0.0000–240Output frame rate. 0 keeps the source rate. Fractional rates such as 23.976 are allowed.
    max_framesINT00–1000000Hard cap on the number of loaded frames. 0 means no cap. It trims the tail of whatever the timeline selected, after the frame rate and the frame step have been applied — the node's status line always shows how many frames actually come out.
    longer_sideINT00–16384Length of the longer side of the frame. 0 derives it from the shorter side, keeping the aspect ratio. Works the same on landscape and portrait footage. Resizing happens inside the decoder, not afterwards.
    shorter_sideINT00–16384Length of the shorter side. 0 derives it from the longer one.
    divisible_byINT11–64Round the output size down to a multiple of this value. Video models usually want 8, 16 or 32.
    frame_stepINT11–1000Keep every Nth frame after the frame-rate stage. 1 keeps them all.
    resize_filterCOMBOareaScaling filter. area suits strong downscaling, lanczos keeps edges sharp, neighbor is for pixel art.
    when_too_largeoptCOMBOstopWhat to do when the frames will not fit in RAM. The ceiling is 60% of the machine's memory (at least 8 GB), or whatever TS_VIDEO_MAX_BYTES says. • stop (default) — refuse with a message naming the size, so nothing quietly starts paging. • use disk — put the frames in a memory-mapped file in the ComfyUI temp folder. What comes out is an ordinary IMAGE tensor, and the allocation cannot fail outright however big the clip is. Be honest about the cost: decoding writes every frame once, so memory still climbs towards the full size while it runs (measured: a 31.9 GB clip took 92 s on disk against 51 s in RAM). What you gain is that those pages are backed by a real file, so the system can drop them instead of failing, and downstream only the frames a node touches are read back. Make sure the temp drive has room; the file goes away when the run releases the tensor, and leftovers are swept on the next decode.

    Outputs (4)

    NameTypeDescription
    imagesIMAGEDecoded frames [B,H,W,C], float32 in 0..1.
    audioAUDIOAudio for the same time range. Nothing at all when the file has no audio track — silence would quietly overwrite a real track further down the graph.
    video_infoTS_VIDEO_INFOMetadata bundle. Feed it into TS Video Info to get the numbers.
    videoVIDEOThe trimmed source file itself, without resizing or frame-rate change. A cheap reference for nodes that take VIDEO.