Any-to-Bokeh Brings Video Rack Focus to ComfyUI

Introduction
You've generated the perfect shot, but everything is in focus, and it looks like a phone video instead of a film. ComfyUI-AnyToBokeh is a new, unofficial custom-node pack by developer alexanz314. The first commit landed Oct 31 and the latest on Nov 1. It brings vivoCameraResearch's Any-to-Bokeh (an ICLR 2026 paper) into ComfyUI as a video-to-video refocusing step.
The idea is simple and lovely. Your sharp "master" clip stays frozen, and the model paints depth-aware, temporally steady bokeh on top. Want the focus to slide from the hero to the background at frame 75? You write that as a keyframe, and the subject can't drift between takes, because nothing gets regenerated. The weights are open but non-commercial, and it runs locally on your own NVIDIA GPU.
What Shipped
Six nodes, two workflows
- Disparity from Depth turns ComfyUI's core Depth Anything 3 output into the disparity maps Any-to-Bokeh expects.
- Focus Control lets you script the focal plane as
frame:targetpairs, with a curve editor right on the node. - Focus From Mask locks focus onto an object from a mask. The included workflow gets that mask from the core SAM 3.1 detector with a plain text prompt like
person. - Preview CoC shows the blur (circle-of-confusion) map before you spend GPU time.
- Load Model and Generate run the modified Stable Video Diffusion UNet.
- The two workflows ship in the repo's
workflows/folder:any2bokeh_curve(a keyframed rack focus) andany2bokeh_sam_mask(follow-the-subject focus).
The focus script
The Focus Control node accepts entries separated by ; or newlines:
frameis a frame index orend.targetis a plane value (0–1 or 0–255), the wordsnear,midorfar, or anx,ypoint in the frame.- A single entry gives a fixed focal plane for the whole clip.
- Interpolation can be
smooth(cosine ease),linearorhold(hard cuts).
The bundled example pulls focus from near to far over 200 frames:
0:0.75;75:0.5;200:0.0Default settings
- 1024×576 output, a single inference step, and blur strength
k16 (adjustable from 0 to 64, or set per frame). - Frames are processed in groups of 8 with 4 frames of overlap, at 7 fps conditioning and motion bucket 127.
Hardware and Setup Notes
- The author tested it on Ubuntu with a 24 GB card.
- The Any-to-Bokeh UNet is a 7.5 GB diffusers folder plus a 393 MB VAE, downloaded from the upstream Google Drive link.
- It also needs a slice of SVD-XT. The workflow note shows how to fetch only the roughly 1.2 GiB diffusers actually uses, instead of the full 21.5 GiB repo.
- By default the model runs in an isolated subprocess, which keeps its pinned-era code and weights away from ComfyUI's own allocator. You point the Generate node at a Python binary.
- Don't enable both
ComfyUI-AnyToBokehand a_v2copy, because the node names collide.
Try It
cd ComfyUI/custom_nodes
git clone https://github.com/alexanz314/ComfyUI-AnyToBokehRestart ComfyUI and load workflows/any2bokeh_curve_00001_.json. Then update the paths in AnyToBokehLoadModel and the Python path in AnyToBokehGenerate, since the pack uses its own weights loader. A nice trick: render your shot with any video model first, then use this as a last "lens" pass.
Licenses at a Glance
- The upstream Any-to-Bokeh code and weights are licensed non-commercial (Creative Commons BY-NC family). Use them for personal projects and research, not client work.
- SVD-XT, Depth Anything 3 and SAM 3.1 each keep their own licenses.
- The node pack has no license file of its own yet.
Original Source
- Node pack: https://github.com/alexanz314/ComfyUI-AnyToBokeh
- Upstream model: https://github.com/vivoCameraResearch/any-to-bokeh
- Paper: https://arxiv.org/abs/2505.21593
Conclusion
Focus is one of the quiet tricks that makes footage feel directed, and until now it was hard to add after the fact without a regeneration that changes your subject. This pack treats bokeh like a lens you can re-rack as often as you like, with a script you can read. It's early, unofficial and non-commercial, but if you have a 24 GB card and a too-sharp clip, give your shot a little cinema.
—Aurelia ♡
