Input Switch
One socket that eats an image or a video and caps its size
- Image
- Video
- image
- width
- height
- frame_count
- images
Video-to-video workflows have a boring, fiddly problem: whatever you feed in has to be a size the model can handle, and the frame count has to be right. Input Switch is the node that swallows that problem. Give it a single image or a clip of frames, tell it the biggest dimensions you'll tolerate, and it hands back resized media plus the real width, height, and frame count as numbers you can wire into the graph.
It ships in bmgjet's comfyui-inputswitch pack - a grab-bag that also contains RIFE frame interpolation, an InsightFace face-swap node, and color matching. You'll most often meet Input Switch inside a shared LTX or Wan workflow, right after the video loader and before the VAE encode - the spot where source media gets tamed before the model looks at it.
How it works
The mechanism is simple, and the source makes it easy to see. It takes your max_width and max_height, rounds them down to even numbers, and then only does work if your media is actually bigger than the cap. If the input is already within bounds it passes straight through untouched - this is a downscale-to-fit node, not an upscaler, so treat "max" as a ceiling, not a target. When it does resize, it picks the scale that fits the longer side, keeps the aspect ratio, and resamples with bicubic plus antialiasing via kornia. It also moves the tensor to your GPU first.
Everything runs in two modes you pick with the mode dropdown:
- Image mode expects a single still (
Imagesocket) and returns it resized, withframe_countfixed at 1. - Video mode expects a batch of frames (
Videosocket, shape N×H×W×C - load them with a video loader first; this node takes tensors, not file paths), resizes every frame, and reports the real frame count.
The inputs and outputs that matter
Only three widgets: mode, max_width, and max_height (default 1024, range 64–2048). The two optional sockets are Image and Video - connect the one that matches your mode.
Outputs are image, width, height, frame_count, and images. The width/height/frame_count numbers are genuinely useful to wire into downstream nodes. But here's the part that will bite you, straight from the source:
- In Video mode, the
imageoutput is only the last frame, andimagesis the clip minus that last frame. The node literally splits your clip in half before handing it back. - In Image mode,
imageis the resized still, andimagesis that same still duplicated into a two-frame stack.
The naming is optimistic. If you wire image from a video expecting the whole clip, you'll silently get one frame. This looks like it was shaped around the pack's own RIFE interpolation workflow, where last-frame-plus-rest is exactly what you feed an interpolator - but for general use, check which output you're actually pulling.
Installing it
Every node in this pack installs the same way. Easiest is ComfyUI Manager - search for comfyui-inputswitch - or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/bmgjet/comfyui-inputswitch.git
Then restart ComfyUI. One warning before you click: this pack installs a lot. Its requirements.txt pins torch==2.9.1 and drags in kornia, onnxruntime-gpu, Cython, meson-python, opencv, and requests, and on top of that the auto-installer fetches OS- and Python-version-specific wheels for numpy and insightface (Python 3.12 is the sweet spot; the README asks for CUDA 12.8). On a stock ComfyUI, insightface and onnxruntime won't be present - and that's exactly the trigger for the auto-install, which can rewrite your torch to the pinned version. If you value your current environment, snapshot it before installing.
Troubleshooting
- "No image provided for 'Image' mode" (or the video equivalent): you left the socket that matches your mode unconnected. Both sockets are optional, and the one you don't use stays empty - wire the one that matches
mode. - Odd dimensions: the node rounds its caps down to even automatically, so the
width/heightoutputs are always even numbers. If you need multiples of 32 or 64 (LTX wants width/height divisible by 32, and Flux/SDXL like 64), set your caps accordingly rather than expecting the node to hit them. - Only one frame came out: see the
imagevsimagesquirk above - you grabbed the wrong output for a video input.
If the pack feels heavy for your use, that's fair: it's a toolbox, not a scalpel. For the specific job of prepping source media for a video pass, Input Switch does it in one node and tells you what it got.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | 2 options: Image, Video | |
| max_width | INT | 102464–2048 | — |
| max_height | INT | 102464–2048 | — |
| Imageopt | IMAGE | — | |
| Videoopt | IMAGE | — |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| width | INT | — |
| height | INT | — |
| frame_count | INT | — |
| images | IMAGE | — |