Skip to content

WebCam Capture

Video Lecture

Section Video Links
WebCam Capture WebCam Capture

Description

Using a webcam input in ComfyUI.

We need to generate frames quickly.

We can use an LCM (Latent Consistency Models) LoRA to speed up the image generation.

LCM is able to generate good results in just a few steps (often 2–8).

  1. Download pytorch_lora_weights.safetensors,

  2. Rename it to LCM_LoRA_Weights_SD15.safetensors

  3. Save it into your ComfyUI/models/loras fo4lder and refresh the node definitions.

I used several SD1.5 based checkpoints in the video.

You can download these models and save them into your ComfyUI/models/checkpoints folder.

  1. Dreamshaper 8 (huggingface)

  2. ToonYou (huggingface)

  3. anythingv3 (huggingface)

Workflow

Copy & paste this into ComfyUI.

{
  "id": "cff11cd9-b703-43c9-9792-ab10fc85857d",
  "revision": 0,
  "last_node_id": 13,
  "last_link_id": 18,
  "nodes": [
    {
      "id": 3,
      "type": "KSampler",
      "pos": [1101.864013671875, 194.92025756835938],
      "size": [315, 474],
      "flags": {},
      "order": 6,
      "mode": 0,
      "inputs": [
        {
          "name": "model",
          "type": "MODEL",
          "link": 14
        },
        {
          "name": "positive",
          "type": "CONDITIONING",
          "link": 4
        },
        {
          "name": "negative",
          "type": "CONDITIONING",
          "link": 6
        },
        {
          "name": "latent_image",
          "type": "LATENT",
          "link": 11
        }
      ],
      "outputs": [
        {
          "name": "LATENT",
          "type": "LATENT",
          "slot_index": 0,
          "links": [7]
        }
      ],
      "properties": {
        "cnr_id": "comfy-core",
        "ver": "0.3.52",
        "Node name for S&R": "KSampler"
      },
      "widgets_values": [0, "fixed", 4, 1, "lcm", "sgm_uniform", 0.6]
    },
    {
      "id": 7,
      "type": "CLIPTextEncode",
      "pos": [824.339599609375, 319.4147033691406],
      "size": [242.61402893066406, 88],
      "flags": {
        "collapsed": true
      },
      "order": 5,
      "mode": 0,
      "inputs": [
        {
          "name": "clip",
          "type": "CLIP",
          "link": 17
        }
      ],
      "outputs": [
        {
          "name": "CONDITIONING",
          "type": "CONDITIONING",
          "slot_index": 0,
          "links": [6]
        }
      ],
      "properties": {
        "cnr_id": "comfy-core",
        "ver": "0.3.52",
        "Node name for S&R": "CLIPTextEncode"
      },
      "widgets_values": ["text, watermark"]
    },
    {
      "id": 11,
      "type": "VAEEncode",
      "pos": [887.1593017578125, 381.49810791015625],
      "size": [140, 46],
      "flags": {},
      "order": 3,
      "mode": 0,
      "inputs": [
        {
          "name": "pixels",
          "type": "IMAGE",
          "link": 10
        },
        {
          "name": "vae",
          "type": "VAE",
          "link": 12
        }
      ],
      "outputs": [
        {
          "name": "LATENT",
          "type": "LATENT",
          "links": [11]
        }
      ],
      "properties": {
        "cnr_id": "comfy-core",
        "ver": "0.3.52",
        "Node name for S&R": "VAEEncode"
      },
      "widgets_values": []
    },
    {
      "id": 6,
      "type": "CLIPTextEncode",
      "pos": [624.870849609375, 183.55262756347656],
      "size": [406.62640380859375, 88],
      "flags": {},
      "order": 4,
      "mode": 0,
      "inputs": [
        {
          "name": "clip",
          "type": "CLIP",
          "link": 16
        }
      ],
      "outputs": [
        {
          "name": "CONDITIONING",
          "type": "CONDITIONING",
          "slot_index": 0,
          "links": [4]
        }
      ],
      "properties": {
        "cnr_id": "comfy-core",
        "ver": "0.3.52",
        "Node name for S&R": "CLIPTextEncode"
      },
      "widgets_values": ["woman, librarian, with floral dress"]
    },
    {
      "id": 12,
      "type": "LoraLoader",
      "pos": [268.7789306640625, 234.10455322265625],
      "size": [270, 126],
      "flags": {},
      "order": 2,
      "mode": 0,
      "inputs": [
        {
          "name": "model",
          "type": "MODEL",
          "link": 13
        },
        {
          "name": "clip",
          "type": "CLIP",
          "link": 15
        }
      ],
      "outputs": [
        {
          "name": "MODEL",
          "type": "MODEL",
          "links": [14]
        },
        {
          "name": "CLIP",
          "type": "CLIP",
          "links": [16, 17]
        }
      ],
      "properties": {
        "cnr_id": "comfy-core",
        "ver": "0.3.52",
        "Node name for S&R": "LoraLoader"
      },
      "widgets_values": ["LCM_LoRA_Weights_SD15.safetensors", 1, 1]
    },
    {
      "id": 10,
      "type": "WebcamCapture",
      "pos": [381.4731750488281, 486.6246032714844],
      "size": [385.1535339355469, 408],
      "flags": {},
      "order": 0,
      "mode": 0,
      "inputs": [],
      "outputs": [
        {
          "name": "IMAGE",
          "type": "IMAGE",
          "links": [10]
        }
      ],
      "properties": {
        "cnr_id": "comfy-core",
        "ver": "0.3.52",
        "Node name for S&R": "WebcamCapture"
      },
      "widgets_values": ["", 480, 360, true, "capture"]
    },
    {
      "id": 4,
      "type": "CheckpointLoaderSimple",
      "pos": [-134.35279846191406, 320.03778076171875],
      "size": [315, 98],
      "flags": {},
      "order": 1,
      "mode": 0,
      "inputs": [],
      "outputs": [
        {
          "name": "MODEL",
          "type": "MODEL",
          "slot_index": 0,
          "links": [13]
        },
        {
          "name": "CLIP",
          "type": "CLIP",
          "slot_index": 1,
          "links": [15]
        },
        {
          "name": "VAE",
          "type": "VAE",
          "slot_index": 2,
          "links": [8, 12]
        }
      ],
      "properties": {
        "cnr_id": "comfy-core",
        "ver": "0.3.52",
        "Node name for S&R": "CheckpointLoaderSimple",
        "models": [
          {
            "name": "v1-5-pruned-emaonly-fp16.safetensors",
            "url": "https://huggingface.co/Comfy-Org/stable-diffusion-v1-5-archive/resolve/main/v1-5-pruned-emaonly-fp16.safetensors?download=true",
            "directory": "checkpoints"
          }
        ]
      },
      "widgets_values": ["欧美动漫ToonYou.safetensors"]
    },
    {
      "id": 8,
      "type": "VAEDecode",
      "pos": [1501.5948486328125, 89.37715911865234],
      "size": [210, 46],
      "flags": {},
      "order": 7,
      "mode": 0,
      "inputs": [
        {
          "name": "samples",
          "type": "LATENT",
          "link": 7
        },
        {
          "name": "vae",
          "type": "VAE",
          "link": 8
        }
      ],
      "outputs": [
        {
          "name": "IMAGE",
          "type": "IMAGE",
          "slot_index": 0,
          "links": [18]
        }
      ],
      "properties": {
        "cnr_id": "comfy-core",
        "ver": "0.3.52",
        "Node name for S&R": "VAEDecode"
      },
      "widgets_values": []
    },
    {
      "id": 13,
      "type": "PreviewImage",
      "pos": [1508.1072998046875, 205.11289978027344],
      "size": [140, 246],
      "flags": {},
      "order": 8,
      "mode": 0,
      "inputs": [
        {
          "name": "images",
          "type": "IMAGE",
          "link": 18
        }
      ],
      "outputs": [],
      "properties": {
        "cnr_id": "comfy-core",
        "ver": "0.3.52",
        "Node name for S&R": "PreviewImage"
      },
      "widgets_values": []
    }
  ],
  "links": [
    [4, 6, 0, 3, 1, "CONDITIONING"],
    [6, 7, 0, 3, 2, "CONDITIONING"],
    [7, 3, 0, 8, 0, "LATENT"],
    [8, 4, 2, 8, 1, "VAE"],
    [10, 10, 0, 11, 0, "IMAGE"],
    [11, 11, 0, 3, 3, "LATENT"],
    [12, 4, 2, 11, 1, "VAE"],
    [13, 4, 0, 12, 0, "MODEL"],
    [14, 12, 0, 3, 0, "MODEL"],
    [15, 4, 1, 12, 1, "CLIP"],
    [16, 12, 1, 6, 0, "CLIP"],
    [17, 12, 1, 7, 0, "CLIP"],
    [18, 8, 0, 13, 0, "IMAGE"]
  ],
  "groups": [],
  "config": {},
  "extra": {
    "ds": {
      "scale": 0.667069486404836,
      "offset": [100.12038440498414, 60.52653107795555]
    },
    "frontendVersion": "1.25.10",
    "VHS_latentpreview": false,
    "VHS_latentpreviewrate": 0,
    "VHS_MetadataImage": true,
    "VHS_KeepIntermediate": true
  },
  "version": 0.4
}