VideoToFrame-badger
Video to training-ready PNG frames in one go
- STRING
Every video-to-image workflow starts the same way: tear the video into frames. VideoToFrame-badger does that, but with one genuinely useful twist - it rescales the frames so the shortest side lands on a number you choose. For training data and image-gen pipelines, that "resize while extracting" step saves you a whole extra pass, because you get frames that are already a sane working size instead of whatever resolution the source happened to be.
The mechanism is a two-part dance. First it reads the video's dimensions with moviepy's VideoFileClip. Then it shells out to ffmpeg on the command line with an fps=<frame_rate> filter and a scale that preserves aspect ratio while forcing the min side to your min_side_length (the long side gets -1, meaning "figure it out"). Output quality is -q:v 2, decent for PNG frames. The frames land as frame_00001.png, frame_00002.png, etc., inside a VideoCutDir/<save_name> folder - which, importantly, lives inside the pack's own directory, not ComfyUI's input or output folders.
The inputs:
- video_path - path to the video file.
- save_name - folder name for the frames (default
temp). The folder is deleted and recreated each run, so it always contains only the latest extraction. - min_side_length - int, default 512, the target for the shorter side.
- frame_rate - int, default 24, frames per second to sample.
Output is a single STRING: the path to the folder holding the frames.
Now the gotchas, and one of them is a genuine footgun. The pack's requirements.txt doesn't pin moviepy, and the code does from moviepy.editor import VideoFileClip - that import path only exists in moviepy 1.x. If pip hands you moviepy 2.x (which it will, because moviepy unpinned resolves to the latest), the node dies with an ImportError about moviepy.editor. This is a real, known issue - there's a GitHub PR fixing it by changing the import to from moviepy import VideoFileClip. If you hit it, either pin moviepy==1.0.3 in your environment or apply that one-line fix yourself.
Second, it calls ffmpeg as an external binary via subprocess, so ffmpeg has to be on your PATH. ComfyUI desktop bundles a Python, not necessarily a PATH-visible ffmpeg - if you get a "ffmpeg: command not found" or a silent failure, install ffmpeg and make sure it's reachable from the shell ComfyUI runs in.
Third, the output location. Frames go into <pack_dir>/VideoCutDir/<save_name>/, which is easy to lose track of and easy to leave gigabytes of PNGs sitting in. Know where it writes before you point a 4K video at it.
Install is standard:
cd ComfyUI/custom_nodes
git clone https://github.com/AbyssYuan0/ComfyUI_BadgerTools
or search ComfyUI_BadgerTools in ComfyUI Manager, then restart. The pack's full requirements.txt (moviepy, open_clip_torch, sentence_transformers, scikit-image, opencv) is heavy - most of it is for this node's siblings, but you get the whole bill when the pack installs. Solid node for frame extraction; just watch the moviepy version.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| video_path | STRING | — | |
| save_name | STRING | temp | — |
| min_side_length | INT | 5121–4096 | — |
| frame_rate | INT | 241–4096 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| STRING | STRING | — |