Nodes/ComfyUI-Base64-Nodes/First Frame => Base64
ComfyUI Node

First Frame => Base64

Grab a video's opening frame and ship it as a base64 string

By dewittethomas·Created 5 months ago·Updated 4 months ago· 0
First Frame => Base64
  • images
  • base64

The one-frame extractor for video pipelines

First Frame => Base64 takes a batch of images - a video's frame stack, a batch of generated frames - and hands you the first frame as a base64-encoded PNG string. It's a small node with a specific job: get one frame out of a video pipeline in a form you can actually do something with.

Video workflows are where this earns its keep. You load a video with VideoHelperSuite, run your frames through the graph, and at some point you want to send the opening frame somewhere JSON-ish - to an external captioning or vision service, to an IP-Adapter-style reference call, or back out to your own API client for a preview. Base64 is the currency for all of that: it's how binary data travels through the ComfyUI API, which is JSON end to end and can't carry raw pixels.

How it works

Under the hood it's exactly what the name promises. The node takes the batch of frames, slices out images[0], clamps it to the 0–1 range, converts it to a PIL image, saves it as PNG into memory, and base64-encodes those bytes into a single string. Out comes the first frame, no temp file, no disk writes, no decoding step you have to manage yourself.

The base64 string is raw PNG data - no data:image/png;base64, prefix, no headers. Whatever receives it needs to prepend that itself if it expects a data URI.

Input and output

There's exactly one required input and one output:

  • images (IMAGE) - the batch of frames. Feed it a video's frames or any multi-frame batch.
  • base64 (STRING) - the first frame, PNG-encoded.

If you feed it a single image, images[0] is that image and you get it back verbatim as base64. If you feed it 40 frames of a video, you get frame 1 and only frame 1. The whole batch never gets encoded - this is a first-frame extractor, not a batch encoder. (The same pack's sibling nodes cover the other cases: ImageToBase64 for single images, LastFrameToBase64 for the closing frame.)

Installing it

Search ComfyUI-Base64-Nodes in ComfyUI Manager and install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/dewittethomas/ComfyUI-Base64-Nodes
pip install -r requirements.txt

Restart ComfyUI and you'll find First Frame => Base64 under the Base64-Nodes category. No model downloads - the only dependency is imageio-ffmpeg, and this node doesn't even touch ffmpeg; it's pure PIL + base64.

Where people get burned

  • Expecting the whole batch. The output is one string, one frame. If you need every frame encoded, this isn't the node - look for a batch encoder.
  • Expecting a data URI. You get raw PNG base64. Clients that want data:image/png;base64,... need to add the prefix themselves.
  • Nothing visible happens. No image renders, no file appears. To actually do something with the string, wire it somewhere - into an API call, or into the pack's Save Base64 (Websocket) node to stream it out to a client.

It's a dead-simple utility in a MIT-licensed pack with a minimal footprint - no network calls, no model files. If your video pipeline needs to hand its opening frame to the outside world, this is the cheapest way to get it there.

CategoryBase64-Nodes

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE

Outputs (1)

NameTypeDescription
base64STRING