Skip to content

WHIP

An input type that allows streaming video and audio to the Smelter over WHIP. Smelter exposes WHIP server on port defined by SMELTER_WHIP_WHEP_SERVER_PORT.

To connect new input, register it with Smelter.registerInput and establish WHIP connection to /whip/:input_id endpoint.

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/whip/example
}
void run();

RegisterWhipInput

import { RegisterWhipInput } from "@swmansion/smelter"

Parameters for an input stream from WHIP source. At least one of video and audio has to be defined.

Type definitions

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

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

Inputs.InputWhipVideoOptions

import { Inputs } from "@swmansion/smelter"

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 - uses FFmpeg’s H.264 software decoding.
    • vulkan_video - uses Vulkan Video for hardware-accelerated decoding.

Inputs.InputWhipAudioOptions

import { Inputs } from "@swmansion/smelter"

Parameters of a 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