WHIP server
An input type that provides a WHIP server endpoint. It allows you to stream media to the Smelter.
Smelter exposes WHIP endpoint on port 9000 under /whip/:input_id route. A different port can be
configured with SMELTER_WHIP_WHEP_SERVER_PORT.
To connect new input, register it first with Smelter.registerInput and then establish a WHIP connection.
Usage
import Smelter from "@swmansion/smelter-node";
async function run() { const smelter = new Smelter(); await smelter.init(); await smelter.registerInput("example", { type: "whip_server", video: { decoderPreferences: ["ffmpeg_h264", "any"], }, }); // At this point you can establish WHIP connection to // http://localhost:9000/whip/example}void run();Reference
Type definitions
type RegisterWhipServerInput = { type: "whip_server"; video?: VideoOptions; bearerToken?: string; required?: boolean; bufferSizeMs?: number; sideChannel?: SideChannel;};Parameters for registering an WHIP endpoint as an input.
Properties
video
Parameters of a video included in the WHIP stream.
- Type:
VideoOptions
bearerToken
Authentication token. If not provided, a random token will be generated and returned from the register input call.
- Type:
string
required
Determines if the input stream is essential for output frame production. If set to true and the stream is delayed, Smelter will postpone output frames until the stream is received.
- Type:
boolean - Default value:
false
bufferSizeMs
Minimum and starting size of the jitter buffer in milliseconds. The buffer adapts dynamically based on observed network jitter but will not shrink below this value. Higher values trade latency for resilience.
- Type:
number
sideChannel
Enable side channel publishing for this input. The external
consumer reads decoded frames / audio from a Unix socket created under
SMELTER_SIDE_CHANNEL_SOCKET_DIR.
- Type:
SideChannel - Option availability: Node.js
VideoOptions
Parameters of a video source included in the WHIP stream.
Type definitions
type VideoOptions = { decoderPreferences?: VideoDecoder[];}Properties
decoderPreferences
An ordered list of preferred video decoders. The first element in the list has the highest priority during WHIP negotiation.
- Type:
VideoDecoder[] - Default value:
[ "any" ]
Behavior:
- If the list ends with “any”:
- Smelter will first try the decoders explicitly listed (in order) and use the first one that is supported and negotiated in WHIP signaling.
- If none of the listed decoders are supported, Smelter will fall back to any supported codec from the negotiated list that wasn’t already in the preferences.
- If “any” is not included:
- Only the decoders listed will be considered.
- If none are supported, no fallback will occur.
VideoDecoder
Video decoder type.
Type definitions
type VideoDecoder = "ffmpeg_h264" | "vulkan_h264" | "ffmpeg_vp8" | "ffmpeg_vp9" | "any"- Type: “ffmpeg_h264” | “vulkan_h264” | “ffmpeg_vp8” | “ffmpeg_vp9” | “any”
- Supported values:
"ffmpeg_h264"- Software H264 decoder based on FFmpeg."vulkan_h264"(Required feature: gpu-video ) - Hardware decoder. Requires GPU that supports Vulkan Video decoding."ffmpeg_vp8"- Software VP8 decoder based on FFmpeg."ffmpeg_vp9"- Software VP9 decoder based on FFmpeg."any"- Automatically selects any video decoder supported by Smelter.
SideChannel
Per-track side channel configuration. See the Side Channel overview for details on how decoded data is exposed and consumed.
Type definition
type SideChannel = { video?: boolean; audio?: boolean; delayMs?: number;};Properties
video
Publish decoded RGBA video frames for this input on the side channel.
- Type:
boolean - Default value:
false
audio
Publish decoded PCM audio batches for this input on the side channel.
- Type:
boolean - Default value:
false
delayMs
Side channel delay in milliseconds. Frames are buffered for this duration ahead of when the queue consumes them, so the side-channel subscriber receives them early and has roughly this much time to process before the frame is due.
- Type:
number - Default value:
0