Skip to main content

Sending and receiving video for video-to-video (V2V) pipelines

This guide shows how to set up a WebRTC connection for video-to-video mode - sending input video (webcam, screen, or file) and receiving generated video.

Overview

In video-to-video mode:
  • You send video frames as input (e.g., webcam, screen capture)
  • The server transforms the video based on your prompts
  • Generated video is streamed back in real-time

Prerequisites

  1. Server is running: uv run daydream-scope
  2. Models are downloaded for your pipeline
  3. Pipeline is loaded (see Load Pipeline)

Complete Example


Step-by-Step Breakdown

1

Get ICE Servers

The server returns STUN/TURN server configuration. If TURN credentials are configured (via HF_TOKEN or Twilio), this enables connections through firewalls.
2

Create Peer Connection

3

Create Data Channel

The data channel allows bidirectional communication:
  • Client to Server: Send parameter updates (prompts, settings)
  • Server to Client: Receive notifications (stream stopped, errors)
4

Add Input Video Track

Unlike receive-only mode which uses addTransceiver("video"), video-to-video mode adds an actual video track from your input source. This can be:
  • Webcam: navigator.mediaDevices.getUserMedia({ video: true })
  • Screen capture: navigator.mediaDevices.getDisplayMedia({ video: true })
  • File/canvas: Using a <canvas> element with captureStream()
5

Handle Incoming Track

6

Send Offer with Initial Parameters

Note the input_mode: "video" parameter which tells the server to expect input video.
7

Complete Signaling


Update Parameters During Streaming

After connection is established:

Stopping the Stream


Error Handling


VACE vs Standard V2V

When VACE is enabled on the pipeline (default), input video is routed through VACE for structural guidance. When disabled, input video is encoded and used for denoising.
See VACE for more details.

Performance Tips

Match Resolution

Set input resolution to match pipeline resolution for best quality:

Frame Rate

Lower frame rates reduce bandwidth and processing load:

See Also

Receive Video

Text-to-video mode (no input)

Send Parameters

Update parameters during streaming

VACE

Reference image conditioning

Load Pipeline

Configure pipeline before streaming