Skip to content

Config

Configuration for WebRTC streaming sessions.

StreamConfig dataclass

Unified configuration for all WebRTC stream types.

This configuration applies to all stream sources (webcam, RTSP, video file, manual) and controls output routing, processing behavior, and network settings.

Source code in inference_sdk/webrtc/config.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
@dataclass
class StreamConfig:
    """Unified configuration for all WebRTC stream types.

    This configuration applies to all stream sources (webcam, RTSP, video file, manual)
    and controls output routing, processing behavior, and network settings.
    """

    # Output configuration
    stream_output: List[str] = field(default_factory=list)
    """List of workflow output names to stream as video"""

    data_output: List[str] = field(default_factory=list)
    """List of workflow output names to receive via data channel"""

    # Processing configuration
    realtime_processing: bool = True
    """Whether to process frames in realtime (drop if can't keep up) or queue all frames"""

    declared_fps: Optional[float] = None
    """Optional FPS declaration for the stream.

    Note: Some sources (like WebcamSource) auto-detect FPS from the video device and will
    override this value. The source's detected FPS takes precedence over this configuration.
    For sources without auto-detection (like ManualSource), this value will be used if provided.
    """

    # Network configuration
    turn_server: Optional[Dict[str, str]] = None
    """TURN server configuration: {"urls": "turn:...", "username": "...", "credential": "..."}

    Provide this configuration when your network requires a TURN server for WebRTC connectivity.
    TURN is automatically skipped for localhost connections. If not provided, the connection
    will attempt to establish directly without TURN relay.
    """

    # Workflow parameters
    workflow_parameters: Dict[str, Any] = field(default_factory=dict)
    """Parameters to pass to the workflow execution"""

    # Serverless configuration
    requested_plan: Optional[str] = None
    """Requested compute plan for serverless processing (e.g., 'webrtc-gpu-small').

    Only applicable when connecting to Roboflow serverless endpoints.
    """

    requested_region: Optional[str] = None
    """Requested region for processing (e.g., 'us', 'eu').

    Must be a valid Modal region. Only applicable when connecting to Roboflow serverless endpoints.
    See: https://modal.com/docs/guide/region-selection#region-options
    """

data_output = field(default_factory=list) class-attribute instance-attribute

List of workflow output names to receive via data channel

declared_fps = None class-attribute instance-attribute

Optional FPS declaration for the stream.

Note: Some sources (like WebcamSource) auto-detect FPS from the video device and will override this value. The source's detected FPS takes precedence over this configuration. For sources without auto-detection (like ManualSource), this value will be used if provided.

realtime_processing = True class-attribute instance-attribute

Whether to process frames in realtime (drop if can't keep up) or queue all frames

requested_plan = None class-attribute instance-attribute

Requested compute plan for serverless processing (e.g., 'webrtc-gpu-small').

Only applicable when connecting to Roboflow serverless endpoints.

requested_region = None class-attribute instance-attribute

Requested region for processing (e.g., 'us', 'eu').

Must be a valid Modal region. Only applicable when connecting to Roboflow serverless endpoints. See: https://modal.com/docs/guide/region-selection#region-options

stream_output = field(default_factory=list) class-attribute instance-attribute

List of workflow output names to stream as video

turn_server = None class-attribute instance-attribute

TURN server configuration: {"urls": "turn:...", "username": "...", "credential": "..."}

Provide this configuration when your network requires a TURN server for WebRTC connectivity. TURN is automatically skipped for localhost connections. If not provided, the connection will attempt to establish directly without TURN relay.

workflow_parameters = field(default_factory=dict) class-attribute instance-attribute

Parameters to pass to the workflow execution