Nodes/ComfyUI_Local_Media_Manager/Select Original Video
ComfyUI Node

Select Original Video

Turn a video in your library into a frame batch — with its audio track still attached

By Firetheft·Created about a year ago·Updated 9 months ago· 143
Select Original Video
  • paths
  • IMAGE
  • frame_count
  • width
  • height
  • fps
  • audio
  • video_info
index0
generation_width1024
generation_height1024
aspect_ratio_preservation
force_rate0
frame_load_cap0
skip_first_frames0
select_every_nth1

Video in ComfyUI is a chain of chores: find the file, decode it, pick the frames you actually want, resize them to something the model's VAE can eat, and somehow keep the audio around. This node automates the ugly middle. Select Original Video grabs one video from your Local Media Manager multi-select, decodes it into a frame batch with OpenCV, resizes each frame to your target, and hands you the audio track as a separate output. One node, both halves of a video pipeline.

How it works

Wire the gallery's paths output in, set index, and the node pulls that video's path out of the selection JSON. Frames are decoded with cv2.VideoCapture (that's why the pack's real dependency is opencv-python-headless, not the heavier moviepy the README once mentioned), then resized with common_upscale and stacked into an IMAGE tensor in temporal order - so frame 0 of the batch is frame 0 of the video. The audio is decoded separately by shelling out to ffmpeg and handed back in the standard ComfyUI AUDIO format (waveform + sample_rate, 44.1kHz stereo), so it plugs into any core audio node. It also emits a video_info JSON with the source's dimensions, fps, total frame count, and duration - useful when you want to know what you're working with before you condition on it.

The inputs that matter

  • paths - from the gallery's paths output. Required.
  • index - which selected video, 0-based.
  • generation_width / generation_height and aspect_ratio_preservation - same four-mode resize logic as Select Original Image (original, keep_input, stretch_to_new, crop_to_new). Sizes step by 8 to stay VAE-friendly.
  • force_rate - target fps. 0 keeps the source frame rate; anything up to 240 resamples. Set it when a video model expects a specific frame count or fps.
  • frame_load_cap - max frames to extract. 0 means "load the whole video," which for a long clip means a huge tensor and a lot of VRAM. Set it to the frame count your model needs.
  • skip_first_frames - drop N frames from the start (useful when the first second is a fade-in).
  • select_every_nth - take every Nth frame. 2 halves the frame count while keeping temporal coverage; your cheap way to downsample.

Outputs and where they go

  • IMAGE - the frame batch. Feed it to a video model's image conditioning (this is the standard first-frame / reference-frame input for the Wan, LTX-Video, and HunyuanVideo pipelines), or VAE-encode it yourself.
  • frame_count (INT), width, height (INT), fps (FLOAT) - the actual values after all your sampling, so downstream nodes that need the real numbers can read them instead of guessing.
  • audio (AUDIO) - the video's audio track, trimmed to start where the frames start. Core SaveAudio will write it back out, or you can run it through an audio-conditioned pipeline.
  • video_info (STRING) - the source stats as JSON, mostly for inspection.

Common issues

  • No audio track → the node returns silent audio (zeros) rather than erroring. Your frames are fine; just don't wire audio into something that needs real sound.
  • Huge videos bite you. frame_load_cap = 0 plus a 10-minute clip is a recipe for an out-of-memory run. Pick your cap first; raise select_every_nth if you want coverage without the memory bill.
  • Audio start vs. frames. The audio is trimmed using skip_first_frames / fps as the offset, so if you're skipping frames to drop a fade-in, the audio roughly follows. Roughly - if you need sample-accurate sync, verify with a quick playback pass.

Install via ComfyUI Manager (search "Local Media Manager") or git clone https://github.com/Firetheft/ComfyUI_Local_Media_Manager into custom_nodes/, then pip install -r requirements.txt. Audio extraction needs the ffmpeg binary on your PATH; the rest of the pack's deps are opencv-python-headless, torchaudio, and send2trash.

Category📜Asset Gallery/Local

Inputs (9)

NameTypeDefaultDescription
pathsLMM_ALL_PATHS
indexINT0
generation_widthINT102464–8096Expected video width to generate
generation_heightINT102464–8096Expected video height
aspect_ratio_preservationCOMBOZoom Mode: - keep_input: Maintain the aspect ratio of the original video - stretch_to_new: Stretch to fit the new size - crop_to_new: Cropped to fit new sizes - original: No processing is performed, use the original video size
force_rateFLOAT00–240
frame_load_capINT0
skip_first_framesINT0
select_every_nthINT1

Outputs (7)

NameTypeDescription
IMAGEIMAGE
frame_countINT
widthINT
heightINT
fpsFLOAT
audioAUDIO
video_infoSTRING