Nodes/ComfyUI-LoadAnim-Adv/Load Image/Video From Path
ComfyUI Node

Load Image/Video From Path

The loader that actually handles video, GIFs, and audio

By SineSwiper·Created 7 months ago·Updated 7 months ago· 0
Load Image/Video From Path
    • images
    • mask
    • audio
    • frame_count
    • fps
    path
    RGBAfalse
    width0
    height0
    keep_aspect_ratio

    ComfyUI's built-in Load Image node is fine for a still PNG and useless for everything else. Feed it an MP4 and it'll treat the file as garbage or not even let you pick it. Load Image/Video From Path is the fix: type a path, get frames, an alpha mask, the audio track, and an FPS value out the other side. It's part of the LoadAnim-Adv pack from SineSwiper, and it's the node you want when your source material is an animated GIF, a video clip, or an image sequence sitting somewhere outside ComfyUI's input folder.

    What it does

    This is the "give me a path" variant of the pack's loader. Its sibling, Load Image/Video, shows you a dropdown of files in ComfyUI's input directory with an upload button. This one just takes a string - absolute or relative path - and opens whatever you point it at. Same internals, different way of choosing the file. If you work with material that lives elsewhere on disk, or you're generating the path dynamically (say, from a file-list node further up the graph), this is the one to use.

    How it works

    The node sniffs the MIME type of the file to decide what it's dealing with, then forks:

    • Video (mp4, avi, mov, mkv): it decodes frames through ComfyUI's own VideoFromFile helper, which is ffmpeg under the hood. No extra pip packages, no PyAV, nothing heavy - this pack's requirements.txt is just torch, numpy, and Pillow, all of which a stock ComfyUI already has.
    • Animated images (GIF, animated WebP): it walks the frames with Pillow's ImageSequence.Iterator and stacks them into a single IMAGE tensor.
    • Either way you get a frame_count and an fps - fps pulled from metadata, or derived from the animation duration when it isn't reported. Still images come back as a one-frame tensor with an fps of 0.

    The inputs that matter

    • path - the file path. The only field you must fill in.
    • RGBA - default off. When on, the images output keeps the alpha channel. The mask output always carries transparency data, so you can usually leave RGBA off and grab the mask.
    • width / height - target dimensions after resizing. 0 means keep the original size. The step is 16, which is deliberate: it keeps you honest about alignment for the sampler.
    • keep_aspect_ratio - crop, pad, or stretch. Crop center-crops to the target, pad letterboxes with the detected edge color, stretch squashes. Default is crop.

    Outputs

    images (IMAGE), mask (MASK), audio (AUDIO), frame_count (INT), fps (FLOAT). The audio output is the interesting one - very few loaders bother, and it only shows up for video files. Fair warning: most downstream video nodes can't consume an AUDIO tensor, so if you want the soundtrack in your final render you'll be wiring that output to an audio-aware node.

    Installing

    The pack is called ComfyUI-LoadAnim-Adv. Easiest path is ComfyUI Manager → Custom Nodes Manager → search "LoadAnim" → Install. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/SineSwiper/ComfyUI-LoadAnim-Adv.git
    

    Then restart ComfyUI. No model downloads, no build step.

    Gotchas

    • fps can legitimately be 0 - for still images, or when the metadata is missing. Don't panic, just don't divide by it.
    • Resizing happens per frame, so a 500-frame clip resized to 1024×1024 costs what it costs. Keep width/height at 0 unless you actually need them.
    • The frame selection syntax from the rest of the pack doesn't apply here - this node loads everything. If you want to cherry-pick frames, pipe images into Select Indexes From Images.

    It's not glamorous, but it's the kind of node that quietly removes a whole category of "why won't this load" frustration from your video workflow.

    CategoryLoadAnimAdv/Loaders

    Inputs (5)

    NameTypeDefaultDescription
    pathSTRINGAbsolute or relative path to the image/video file.
    RGBABOOLEANfalseControls whether to include the Alpha channel in the 'image' output. The 'mask' output will always include this data.
    widthINT0Final width of images, after resizing. Zero means to keep the original width.
    heightINT0Final height of images, after resizing. Zero means to keep the original height.
    keep_aspect_ratioCOMBOWhat action to take, when the image doesn't match the expected aspect ratio.

    Outputs (5)

    NameTypeDescription
    imagesIMAGEThe image data, either as a single image or a set of frames.
    maskMASKAny transparency data found in the Alpha channel or transparent palette index.
    audioAUDIOThe audio from the video, if any.
    frame_countINTTotal number of frames loaded from the image.
    fpsFLOATFrames-per-second, as reported from the image metadata. This may be zero, if the data could not be found, or the image doesn't animate.