Skip to content

WHIP

Node.js

An input type that allows streaming video and audio to Smelter over WHIP.

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

whipInputExample.tsx
import Smelter from "@swmansion/smelter-node";
async function run() {
const smelter = new Smelter();
await smelter.init();
await smelter.registerInput("example", {
type: "whip",
video: { decoder: "ffmpeg_h264" },
audio: { decoder: "opus" }
});
// At this point you can establish WHIP connection to
// http://localhost:9000/whip/example
}
void run();

Reference

Type definitions

type RegisterWhipInput = {
type: "whip";
video?: InputWhipVideoOptions;
audio?: InputWhipAudioOptions;
required?: boolean;
offsetMs?: number;
};

Parameters for registering an WHIP endpoint as an input.

Properties

video

Parameters of a video included in the WHIP stream.


audio

Parameters of an audio included in the WHIP stream.


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

offsetMs

Offset in milliseconds relative to the pipeline start (start request). If unspecified, the stream synchronizes based on the delivery time of the initial frames.

  • Type: number

InputWhipVideoOptions

Parameters of a video source included in the WHIP stream.

Type definitions

type InputWhipVideoOptions = {
decoder: "ffmpeg_h264" | "vulkan_video";
}

Properties

decoder

  • Type: "ffmpeg_h264" | "vulkan_video"
  • Supported values:
    • "ffmpeg_h264" - Use the software decoder based on ffmpeg.

    • "vulkan_video" (Required feature:vk-video ) - Use hardware decoder based on Vulkan Video.

      This should be faster and more scalable than the ffmpeg decoder, if the hardware and OS support it.

      This requires hardware that supports Vulkan Video. Another requirement is this program has to be compiled with the vk-video feature enabled (enabled by default on platforms which support Vulkan, i.e. non-Apple operating systems and not the web).

InputWhipAudioOptions

Parameters of an audio source included in the WHIP stream.

Type definitions

type InputWhipAudioOptions = {
decoder: "opus";
forwardErrorCorrection?: boolean;
}

Properties (decoder: “opus”)

forwardErrorCorrection

Specifies whether the stream uses forward error correction. It’s specific for the Opus codec. For more information, visit RFC specification.

  • Type: boolean
  • Default value: false