RTMP server
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 Type | Supported Codecs |
|---|---|
| Video | H.264, VP8*, VP9* |
| Audio | AAC, Opus* |
The RTMP connection is configured using the following parameters:
- The Smelter server address
- The configured RTMP port - defaults to
1935, configurable viaSMELTER_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
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.
- Type:
DecoderMap
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
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_h264will be used, otherwiseffmpeg_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