darkHUB Base64
The copy-and-paste bridge from ComfyUI to every API that eats base64
- images
- audio
- base64_string
- mime_type
- frame_count
You made something good, and the thing downstream of ComfyUI wants it as a base64 string - a Telegram or Discord bot, a webhook, a cloud job platform like RunningHub, some random endpoint you don't control. The old way is Save Image, go dig the file out of output/, and base64 it yourself with a one-liner. darkHUB Base64 is that step as a node: wire in the image, hit run, click one button, paste. No file hunting, no shell commands.
The name tells you almost everything - the whole pack is this single registered node (the author trimmed it down hard in the 3.0.0 release, so there's no sibling node to confuse with it). It takes the IMAGE tensor straight out of VAE Decode, plus an optional AUDIO, and hands you the encoded result.
How it works
Under the hood it's refreshingly simple, and it's all visible in nodes.py. convert() reads the batch size off the tensor shape, resolves the output format - auto means PNG when there's exactly one frame and no audio, MP4 for anything multi-frame or when audio is connected - and turns every frame into a PIL image.
PNG path is trivial: encode the first frame with Pillow. MP4 path is the interesting one: the node pipes raw RGB frames into ffmpeg (libx264, yuv420p, +faststart), muxes in the audio as AAC at 192k if you gave it any, then base64-encodes the whole file. That's it. Three things come out the other end, matched to the three outputs:
base64_string- the payload itself, as aSTRINGyou can wire onward into anything else that wants itmime_type-image/pngorvideo/mp4, which is genuinely useful if the thing you're feeding wants a data URIframe_count- the batch size, so you can tell downstream whether this was a still or a video
It's also an output node (is_output_node: true), which in ComfyUI means it always executes like Preview or Save - the graph runs backward from it. The frontend extension grabs the string from the run and renders the single Copy Base64 button on the node. The button is the point of this node; the STRING outputs are the bonus.
The inputs that matter
images- the only one you must connect. Comes fromVAE Decode.format-auto,png, ormp4. Leave it onautounless you have a reason: it's right about 95% of the time.fps- frame rate for MP4 output (default 24). Does nothing for PNG.quality- this is really a CRF knob wearing a friendly face. The node maps 100→~0 (near-lossless) down to 1→~50, so don't assume quality 100 is "huge and wasteful" - even at max it's efficient, because it's x264 doing the work.audio- optionalAUDIOinput. Only valid with MP4.
Installing it
ComfyUI Manager is the easy path: search "darkHUB-Video-to-Base64" and install. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Cyber05CC/darkHUB-Video-to-Base64
cd darkHUB-Video-to-Base64
pip install -r requirements.txt
Then restart ComfyUI. The dependency list is a single line: imageio-ffmpeg, which bundles a fallback ffmpeg binary. No models to download, nothing heavy.
Where people get burned
- MP4 needs ffmpeg to actually exist. The node prefers a system ffmpeg on your PATH, then falls back to the binary imageio-ffmpeg ships. If neither resolves you get a
RuntimeErrorwith exactly the fix in the message: install ffmpeg orpip install imageio-ffmpeg. - Base64 is ~33% bigger than the bytes, and video is a lot of bytes. A 20-second 720p clip turns into a multi-megabyte wall of text. That will choke an HTTP payload limit and can make the clipboard and the node UI very unhappy. For short clips it's a non-issue; for anything long, check what your endpoint will accept before you commit.
- PNG + audio is a hard error. If you connect
audioand forceformat: png, the node raises instead of silently dropping your track - switch tomp4orauto. - It saves nothing to disk. The payload lives in the node and its outputs. If you also want the file, keep a
Save Image/video node on the graph; this node is purely the copy-paste bridge.
Reach for it when your destination wants raw bytes or a data URI and you'd rather not build the encode yourself. When your destination wants a file or a URL, use Save - but for bots, webhooks, and anything that says "paste your base64 here," this is the tool, and it's one of the few that turns a five-step chore into a click.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| format | COMBO | 3 options: auto, png, mp4 | |
| fps | FLOAT | 24.01–120 | — |
| quality | INT | 1001–100 | — |
| audioopt | AUDIO | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| base64_string | STRING | — |
| mime_type | STRING | — |
| frame_count | INT | — |