加载透明视频 / Load Video (Alpha)
Your transparent WebM dies on import — this node is the alpha rescue
- rgba_image
- alpha
- rgb_image
- 帧数
- 帧率
You generated a gorgeous transparent video - a walking character, a fire overlay, an intro card with a real alpha channel - and the moment you load it into ComfyUI, the transparency is just… gone. Every frame comes back as a solid rectangle on black. You're not doing anything wrong - the loader is the problem.
This node, 加载透明视频 / Load Video (Alpha) from the Rui-Node pack, fixes exactly that one infuriating case. It's what you reach for when you need RGBA frames out of a video - sprite animation frames, composited overlays, effects to drop onto another shot.
Why the alpha vanishes in the first place
Here's the trap, and it's sneaky. A WebM with transparency (VP8 or VP9) does not store alpha in the main video stream. The main stream is still plain yuv420p; the alpha gets squeezed into a second track, buried in Matroska's BlockAdditional sideband, with a single alpha_mode=1 flag on the container as a hint that it exists.
ffmpeg's built-in vp9 / vp8 decoders don't read that sideband at all. Only the libvpx-vp9 / libvpx family does. The common video loaders (VideoHelperSuite and friends) use the default decoder, so they happily decode every frame and hand you alpha that's pinned at 255. It's a silent failure - nothing errors, nothing looks broken, the transparency just isn't there. The Rui-Node README measured all three paths on the same file: PyAV default and ffmpeg default both lose alpha completely; explicit libvpx-vp9 recovers it (87% fully transparent pixels intact).
So what this node actually does is probe the file - via PyAV metadata when available, falling back to parsing ffmpeg -i output - and when it sees alpha_mode=1 or an alpha-bearing pixel format, it switches to a libvpx-family decoder and reads raw RGBA pixels out of the pipe. Same story for MOV/qtrle and ProRes 4444, where the pixel format itself carries alpha.
The inputs that matter
- video - pick from ComfyUI's
inputdirectory (you can also drag-upload). Or fill in 视频路径 with an absolute path and it wins over the dropdown. - 解码器 (decoder) - leave on 自动 (auto) and it swaps to libvpx only when it detects alpha. If auto still returns opaque frames, flip to 强制 libvpx (force libvpx) and you'll almost certainly get your alpha back.
- 强制帧率 (force fps), 帧数上限 (max frames), 跳过前N帧 (skip first N), 间隔 (every N-th frame) - the usual decimation controls. The author's advice for game sprite work: keep force fps at 0. 自定义宽度/高度 resizes; setting just one side keeps the aspect ratio (leave at 0 for pixel-art, since resizing interpolates and blurs hard edges).
What comes out
- rgba_image - 4-channel frames. Wire this straight into ComfyUI's native Save Image node: it detects the 4 channels and writes RGBA PNGs, alpha intact. No extra save node needed.
- alpha - the transparency as a MASK, handy for previewing or feeding a compositor.
- rgb_image - a 3-channel version for downstream nodes that choke on 4 channels.
- 帧数 and 帧率 - actual frame count and output rate (fps divides by the interval if you're skipping frames).
Installing it
ComfyUI Manager, search RUI-Nodes, install, restart. Or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/rui40000/RUI-Nodes
pip install -r requirements.txt
That requirements.txt pulls torch, numpy, Pillow, requests, plus SDMatte's heavier deps (diffusers, transformers, scipy, opencv) - overkill for this one node, but they're all typical ComfyUI env packages. The only real runtime need here is an ffmpeg: it finds one via imageio-ffmpeg, your system PATH, or the copy VideoHelperSuite ships with. If you get a "找不到 ffmpeg" error, pip install imageio-ffmpeg fixes it.
Common gotchas
- Preview shows black. That's not a bug. ComfyUI's preview pane doesn't render transparency, so a black background is normal. Verify with the
alphaoutput or by checking the saved PNG. - Console prints "alpha 全为不透明" (all opaque). The detector didn't see
alpha_mode, or your file really has no alpha. Switch to 强制 libvpx (force libvpx) and retry. - Video preview gets cropped in the UI. If the node's inline preview only shows part of the frame, that's a known CSS clash with the
comfyui-art-ventureplugin, not this node. The pack ships a front-end fix - restart the ComfyUI backend and hard-refresh the browser to pick it up.
It's a one-job node, but it's the right one. Core ComfyUI only gained webm alpha saving in v0.25.0 (mid-2026), so the loading half was the broken half for a long time. This closes the loop: transparent video in, RGBA PNGs out.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| video | COMBO | 从 ComfyUI 的 input 目录里选择视频文件。 若视频不在该目录,可改用下方「视频路径」直接填绝对路径。 | |
| 强制帧率 | FLOAT | 0.000–240 | 按指定帧率重采样。填 0 表示保持视频原始帧率。 例如原视频 8fps、这里填 24,会补成 24fps(重复帧); 填 4 则抽帧减半。做游戏序列帧时通常保持 0 更安全。 |
| 帧数上限 | INT | 00–100000 | 最多读取多少帧,填 0 表示读完整段。 达到上限会立即中止解码,用来快速试跑长视频。 |
| 跳过前N帧 | INT | 00–100000 | 丢弃视频开头的若干帧。 用于跳过片头黑场或起手多余的静止帧。 |
| 间隔 | INT | 11–100 | 每隔几帧取一帧。1=每帧都要,2=隔帧抽取(帧数减半)。 在「跳过前N帧」之后生效。 |
| 自定义宽度 | INT | 00–8192 | 输出宽度,填 0 保持原始尺寸。 只填宽或只填高时,另一边按原比例自动换算。 |
| 自定义高度 | INT | 00–8192 | 输出高度,填 0 保持原始尺寸。 像素素材缩放会让边缘被插值糊掉,做像素游戏时建议保持 0。 |
| 解码器 | COMBO | 自动 | 自动:探测到 alpha_mode=1 的 VP8/VP9 时自动换用 libvpx, 否则用默认解码器(更快)。一般保持「自动」即可。 强制 libvpx:无论探测结果如何都用 libvpx 解码。 当自动模式仍然丢 alpha 时改用这一档。 默认解码器:用 ffmpeg 内置解码器,速度快但 读不到 WebM 边带里的 alpha(这正是常见加载 节点丢透明通道的原因)。 |
| 视频路径opt | STRING | 视频文件的绝对路径。填写后优先于上方的下拉选择。 留空则使用下拉框选中的文件。 |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| rgba_image | IMAGE | 4 通道 RGBA 序列帧。直接接 ComfyUI 原生「保存图像」即可存成 带透明通道的 PNG 序列帧(原生保存节点不会丢 alpha)。 |
| alpha | MASK | 透明通道单独输出为遮罩,可接遮罩预览或参与后续合成。 |
| rgb_image | IMAGE | 3 通道 RGB 序列帧,供只接受 3 通道输入的下游节点使用。 |
| 帧数 | INT | 实际读取到的帧数。 |
| 帧率 | FLOAT | 实际输出的帧率(未设强制帧率时即视频原始帧率)。 |