Skip to content

RTMP server

Node.js Browser (Client)

An input type that allows Smelter to receive streams over RTMP.

Smelter exposes an RTMP endpoint after you register the input with Smelter.registerInput.

Media TypeSupported Codecs
VideoH.264, VP8*, VP9*
AudioAAC, Opus*
* E-RTMP feature.

The RTMP connection is configured using the following parameters:

  • The Smelter server address
  • The configured RTMP port - defaults to 1935, configurable via SMELTER_RTMP_SERVER_PORT
  • The id the input was registered under (used as the RTMP application name)
  • The registered streamKey

Most RTMP clients accept connection parameters in the form of a URL.
Format: rtmp[s]://<smelter_ip>:<port>/<input_id>/<stream_key>

Usage

rtmpServerInputExample.tsx
import Smelter from "@swmansion/smelter-node";
async function run() {
const smelter = new Smelter();
await smelter.init();
await smelter.registerInput("example", {
type: "rtmp_server",
streamKey: "mykey",
});
// Stream to rtmp://127.0.0.1:1935/example/mykey
}
void run();

Once the RTMP server input is registered and Smelter is listening on the configured URL, you can push a stream to it using any RTMP client (e.g. OBS, FFmpeg).

Reference

Type definitions

type RegisterRtmpServerInput = {
type: "rtmp_server";
streamKey: string;
required?: bool;
decoderMap?: DecoderMap;
sideChannel?: SideChannel;
}

Parameters for registering an RTMP server input.

Properties

streamKey

The RTMP stream key a publisher must use to connect to this input.

  • 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

decoderMap

Assigns which decoder should be used for media encoded with a specific codec. Currently, more than one decoder is supported only for H264.


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.

DecoderMap

Maps codecs to the provided decoders.

Type definitions

type DecoderMap = {
h264?: 'ffmpeg_h264' | 'vulkan_h264';
};

Properties

h264

H264 decoder configuration.

  • Type: 'ffmpeg_h264' | 'vulkan_h264'
  • Default value: If available vulkan_h264 will be used, otherwise ffmpeg_h264
  • Supported values:
    • "ffmpeg_h264" - Software decoder based on FFmpeg.
    • "vulkan_h264" (Required feature: gpu-video ) - Hardware-accelerated decoder. Requires GPU that supports Vulkan Video decoding.

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