Empty Image And Mask From Audio β‘π ‘π π £π
Size your canvas to your song, not the other way around
- audio
- empty_image
- empty_mask
- frame_count
This is a scaffolding node: it doesn't generate anything interesting on its own, it just builds an empty canvas and mask sized exactly to the length of your audio track, so every node downstream that needs a frame count can pull it from here instead of you calculating it (and probably getting it slightly wrong, and having your video run half a second short of the song).
What it does
Feed it audio, a frame_rate (default 30), and a width/height (default 512Γ512), and it computes the frame count as duration Γ frame_rate, then hands back an empty_image and empty_mask batch of that length at your chosen resolution, plus frame_count as a plain INT you can wire anywhere a batch length is needed. That's the whole node: audio duration in, correctly-sized blank tensors and a number out.
Why bother with an "empty" node
If you're building an audio-reactive pipeline - say, driving FlexImageWarp or FlexImageParallax off an AudioFeatureExtractor signal - you need your image batch and your feature curve to be the same length as your audio, or things drift out of sync. This node exists so that "the same length as the audio" is computed once, in one place, and reused everywhere, instead of every node in the chain guessing independently. Wire frame_count into whatever else in your graph needs a batch size and everything stays locked to the actual track length.
It overlaps with AudioInfo in one respect - both compute total_frames/frame_count from audio duration and frame rate - but they solve different halves of the problem. AudioInfo is read-only: numbers out, nothing to build on. This node actually allocates the blank tensors at a given resolution, so use AudioInfo when you just need the numbers for math elsewhere in the graph, and use this node when you specifically need a correctly-sized blank canvas and mask to start compositing or generating onto.
Installing it
Via ComfyUI Manager: search RyanOnTheInside, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside
cd ComfyUI_RyanOnTheInside
pip install -r requirements.txt
No model downloads for this one - it's just tensor allocation based on audio length.
Where people get burned
The node doesn't document what value fills empty_mask and empty_image - check what you actually get in your graph before assuming it's all-black or all-zero, since that matters if you're compositing onto it rather than treating it purely as a shape/length placeholder. If you need a specific starting color rather than a blank canvas, this isn't the node for that - pair it with a solid-color fill node downstream instead.
Also worth knowing: this computes frame count from the audio as it is when it reaches this node. If you trim or pad the audio afterward, this node's outputs are already stale - put any AudioTrim/AudioPad editing before this node in the chain, not after, or run it again post-edit.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | Input audio to determine frame count | |
| frame_rate | FLOAT | 30.00.1β120 | Frame rate of the output sequences (0.1 to 120 fps) |
| width | INT | 51216β4096 | Width of the output images and masks (16 to 4096 pixels) |
| height | INT | 51216β4096 | Height of the output images and masks (16 to 4096 pixels) |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| empty_image | IMAGE | β |
| empty_mask | MASK | β |
| frame_count | INT | β |