Nodes/comfyui-timesaver/TS Video Depth
ComfyUI Node

TS Video Depth

Depth map for a sequence of frames, using Video Depth Anything over a sliding window so the result stays steady from frame to frame. For a still — or a batch of unrelated pictures — use TS Image Depth instead: it runs Depth Anything V2, which is both far quicker and sharper on a single frame.

By AlexYez·Created 2 years ago·Updated 3 days ago· 11
TS Video Depth
  • images
  • image
model_filenamevideo_depth_anything_vitl_fp16.safetensors
input_size518
max_res1280
precisionfp16
colormapgray
dithering_strength0.0050
apply_median_blurtrue
upscale_algorithmLanczos4
normalization_modepercentile
denoise_methodbilateral
dither_patternbayer
edge_aware_upscaletrue
flicker_suppression0.00
flicker_radius1
window_length32
window_overlap10
CategoryTS/Video

Inputs (17)

NameTypeDefaultDescription
imagesIMAGEVideo frames as an IMAGE batch (N, H, W, 3) in 0..1. Any aspect ratio; 16:9 is the model's sweet spot.
model_filenameCOMBOvideo_depth_anything_vitl_fp16.safetensorsVideo Depth Anything checkpoint. Downloaded on first use to ComfyUI/models/videodepthanything. • vitl fp16 (~0.75 GB, default) — best quality. Recommended for production. • vits fp16 (~55 MB) — fast, less stable on fine detail. Only safetensors are offered: half the download and an order of magnitude quicker to read (0.01 s against 0.66 s, measured). A graph that still names an old .pth keeps working — the file is simply no longer suggested.
input_sizeINT51864–4096Internal resolution the transformer sees (DINOv2 patch size 14, snapped automatically). Higher = more depth detail, more VRAM / time. For 16:9 source (after max_res cap): • 518 (default, native) — model trained at this size; ~480 K depth pixels. • 644 — ~740 K depth pixels (+54% detail, +54% VRAM/time). Safe on ≥24 GB. • 700 — ~872 K depth pixels (+82% detail, +82% VRAM). OOM risk on 16 GB. • ≥770 — out-of-distribution for DINOv2 (quality can REGRESS). If OOM, the node auto-retries on 518 → 392 → 280 → 168.
max_resINT1280-1–8192Cap on the longer side of input frames before model preprocessing. • Does NOT change depth detail — the model always resamples to input_size. • -1 — no cap. Keeps full-resolution RGB as the guide for edge_aware_upscale, giving the sharpest silhouettes on the output. • 1280 (default) — downscales 4K to HD first; saves preprocess RAM and speeds up resize, at the cost of a slightly softer edge-aware upscale. Recommendation: -1 for 4K when edge_aware_upscale=True, 1280 otherwise.
precisionCOMBOfp16Inference dtype. • fp16 (default) — 2× faster, ~50% less VRAM. Required for vitl @ 4K on a 16 GB card. • fp32 — marginally cleaner gradients on smooth surfaces; doubles VRAM, almost always triggers OOM on 4K. Use only on small inputs or ≥24 GB cards.
colormapCOMBOgrayOutput color mapping. • gray (default) — raw normalized depth in all 3 channels. Use this if the depth map feeds downstream nodes (ControlNet, 3D, etc). • inferno / viridis / plasma / magma / cividis — perceptually uniform matplotlib colormaps for visualization only. Bilinear LUT interpolation removes 8-bit banding.
dithering_strengthFLOAT0.00500–0.016Sub-LSB noise added to the normalized depth before colormap, to break up 8-bit banding when the result is saved as PNG/JPEG. • 0 — no dither. • 0.005 (default) — light, OK with bayer pattern + bilinear LUT. • 0.016 (max) — aggressive, guaranteed banding-free on gray output. If you still see bands, raise toward 0.016 and prefer dither_pattern=bayer.
apply_median_blurBOOLEANtrueLegacy denoise toggle (kept for workflow compatibility). Used only when denoise_method=auto: True → 3×3 median, False → none. When denoise_method is set explicitly (bilateral / median / none), this toggle is ignored.
upscale_algorithmCOMBOLanczos4Resampling kernel for upscaling the depth map back to the original frame size. Used only when edge_aware_upscale=False. • Lanczos4 (default) — bicubic with antialias, the sharpest of the two. • Cubic — the SAME kernel as Lanczos4. PyTorch has no Lanczos, and both labels map to bicubic+antialias, so the two options are pixel-for-pixel identical (verified). Kept because saved workflows carry the value. • Linear — bilinear, softer and cheaper. The only genuinely different choice here.
normalization_modeoptCOMBOpercentileHow to map raw depth onto [0..1]. image is always normalized minmax. • minmax — uses global min/max across the whole video. Simple, but one outlier frame (object very close or far) can squash the contrast of every other frame. • percentile (default, quality) — robust 1%..99% range. Better contrast and temporal stability on long clips. Slightly more memory (samples a subset of pixels for quantile).
denoise_methodoptCOMBObilateralSpatial denoise applied at low-res depth (before upscale). • auto — follow legacy apply_median_blur toggle. • none — no denoise, maximum detail; may show grain on fine textures. • median — 3×3 median, removes impulse noise, slightly blurs thin geometry. • bilateral (default, quality) — edge-preserving 5×5; smooths surface noise while keeping object silhouettes sharp.
dither_patternoptCOMBObayerDither distribution used by dithering_strength. • white — TPDF (triangular) random noise, full antibanding standard, but adds visible grain on flat surfaces. • bayer (default, quality) — deterministic 8×8 ordered pattern. Banding-free, no temporal flicker, no grain. Best paired with bilinear colormap LUT (already enabled).
edge_aware_upscaleoptBOOLEANtrueFinal upscale strategy. • False — plain resampling via upscale_algorithm (Lanczos4 etc). Fastest. • True (default, quality) — Fast Guided Filter using the input RGB as edge guide. Silhouettes snap to real object boundaries; thin geometry is preserved. Costs ~5-10% extra postprocess time. Combine with max_res=-1 to keep the guide at full 4K for the sharpest result.
flicker_suppressionoptFLOAT0.000–1Blends in a temporal MEDIAN of the depth to kill single-frame pops. • 0 (default) — off, output unchanged. • 0.3-0.5 — takes the twitch out of static shots. • 1 — pure median; safe on a locked-off camera, can lag fast motion. A median is used rather than an average on purpose: it drops outliers without smearing real movement.
flicker_radiusoptINT11–8Half-width of the temporal median window, in frames (1 = look at 3 frames, 2 = 5, and so on). Bigger is steadier and slower to react. Ignored when flicker_suppression is 0.
window_lengthoptINT328–32Frames the model sees at once. 32 is both the default and the ceiling: the temporal module carries an absolute positional embedding with exactly 32 slots, so a longer window cannot be built from these weights at all. Lower it only to fit VRAM — shorter windows mean less context and less consistency.
window_overlapoptINT102–24How many frames consecutive windows share. More overlap means smoother joins and proportionally more compute: at the default the model already runs ~1.45 frames for every frame of output. Must stay below window_length.

Outputs (1)

NameTypeDescription
imageIMAGEDepth map as IMAGE (N, H, W, 3) float in 0..1 at the original RGB resolution. Same as a regular IMAGE — feed directly into ControlNet, save nodes, etc.