Nodes/ComfyUI_SparkVSR_SM/SparkVSR_SM_PreRefer
ComfyUI Node

SparkVSR_SM_PreRefer

How you tell SparkVSR which frames to actually restore

By smthemex·Created 5 months ago·Updated 5 months ago· 39
SparkVSR_SM_PreRefer
  • image
  • model
  • sr_image
  • conds
ref_indices 0,16,32
targe_width0
targe_height0
upscale4
save_pisasrtrue

SparkVSR_SM_PreRefer is the "interactive" in the paper's title, and it's where the quality of the whole pipeline is won or lost. You feed it the frames of your source video, tell it which frames are reference keyframes, and it produces the CONDITIONING that SparkVSR_SM_KSampler uses to regenerate the clip. Everything downstream is just following the choices you make here.

The reason this node exists: SparkVSR doesn't upscale every frame with full generative power - that's how you get shimmering, inconsistent video. Instead it properly restores a few chosen keyframes with a strong image upscaler and propagates that detail through the rest of the clip. The authors are explicit that the reference-guided modes are the recommended settings and the no-reference mode is just a baseline. So this node is where you pick your keyframes, and optionally which upscaler restores them.

How it works - the three modes

Which mode you're in depends on the optional inputs you wire:

  • no_ref - neither optional input connected. Zero reference frames, pure propagation from a bilinear upscale. Works, but it's the fallback, not the showcase.
  • pisasr - wire the MODEL from SparkVSR_SM_SRModel. PiSA-SR restores the reference frames locally at 4x (the upscale value). This is the no-API path.
  • SRimg - wire your own sr_image instead. Take a frame, upscale it with anything you trust - SeedVR2, an ESRGAN, whatever - and feed it in. The reference generator is swappable, which is the nicest property of the whole design.

The reference frames get encoded to latent and injected at their source-video frame numbers. If save_pisasr is on, the restored keyframes are also written as PNGs to your output folder - genuinely useful for checking what the model is about to be guided by before you burn an hour of GPU.

The inputs that matter

  • image - your source video as an IMAGE batch, e.g. from a video loader that outputs frames.
  • ref_indices - the keyframe numbers, as a comma-separated string. Default is 0,16,32. The README tip: type 0, (note the trailing comma) to reference only the first frame and save resources. Keyframes must be at least 4 frames apart, or it errors.
  • targe_width / targe_height - output resolution. Leave both at 0 to just apply the upscale factor (default 4x) instead.
  • upscale - how much PiSA-SR (or the effective factor) scales the references.
  • save_pisasr - save the restored keyframe PNGs for inspection.

Output: a single CONDITIONING, wired into SparkVSR_SM_KSampler's conds input.

Installing it

This node alone needs no extra models - the pack's own install (ComfyUI Manager, search "ComfyUI_SparkVSR_SM", or git clone into custom_nodes plus pip install -r requirements.txt and a restart) is enough if you bring your own sr_image. The moment you wire the PiSA-SR model you also need sd21base-f32.safetensors, sd21vae.safetensors, and pisa_sr.pkl in their folders, per the README.

Common issues

  • ref_indices ignored / weird behavior - it's a comma-separated string. If the node can't find a comma it warns and falls back to frame 0 only (the warning prints in both Chinese and English). 0,16,32 with spaces works fine; 0 16 32 doesn't.
  • "Reference frame interval must be > 3" - your keyframes are too close together. Space them at least 4 frames apart.
  • Unexpected cropping - when you set a target resolution, the node scales the video to cover it and center-crops, so a mismatched aspect ratio crops your edges. Leave 0,0 if you want a pure upscale.
  • Unimpressive results - you're probably in no_ref mode. Wire in a reference source; that's the whole game.
CategorySparkVSR_SM

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
ref_indicesSTRING 0,16,32
targe_widthINT00–16384
targe_heightINT00–16384
upscaleINT41–16
save_pisasrBOOLEANtrue
modeloptMODEL
sr_imageoptIMAGE

Outputs (1)

NameTypeDescription
condsCONDITIONING