Nodes/darkHUB Base64/darkHUB Base64
ComfyUI Node

darkHUB Base64

The copy-and-paste bridge from ComfyUI to every API that eats base64

By Cyber05CC·Created 5 months ago·Updated 5 months ago· 0
darkHUB Base64
  • images
  • audio
  • base64_string
  • mime_type
  • frame_count
format
fps24.0
quality100

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 a STRING you can wire onward into anything else that wants it
  • mime_type - image/png or video/mp4, which is genuinely useful if the thing you're feeding wants a data URI
  • frame_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 from VAE Decode.
  • format - auto, png, or mp4. Leave it on auto unless 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 - optional AUDIO input. 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 RuntimeError with exactly the fix in the message: install ffmpeg or pip 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 audio and force format: png, the node raises instead of silently dropping your track - switch to mp4 or auto.
  • 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.

CategorydarkHUB

Inputs (5)

NameTypeDefaultDescription
imagesIMAGE
formatCOMBO3 options: auto, png, mp4
fpsFLOAT24.01–120
qualityINT1001–100
audiooptAUDIO

Outputs (3)

NameTypeDescription
base64_stringSTRING
mime_typeSTRING
frame_countINT