MP4
An input type that allows Smelter to read static MP4 files.
Usage
import Smelter from "@swmansion/smelter-node";
async function run() { const smelter = new Smelter(); await smelter.init(); await smelter.registerInput("example", { type: "mp4", serverPath: "./input.mp4" });}void run();Reference
Type definitions
type RegisterMp4Input = { type: "mp4"; url?: string; serverPath?: string; loop?: bool; required?: bool; offsetMs?: number; decoderMap?: DecoderMap;}Parameters for registering an MP4 file as an input.
Properties
url
URL of the MP4 file.
- Type:
string - Option availability: Node.js , Browser (WASM)
serverPath
Path to the MP4 file, specifying its location on the server where the Smelter instance is deployed.
- Type:
string - Option availability: Node.js
loop
Specifies whether the input should be played in a loop.
- Type:
boolean - Default value:
false - Option availability: Node.js
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 - Option availability: Node.js
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 - Option availability: Node.js
decoderMap
Assigns which decoder should be used for media encoded with a specific codec.
- Type:
DecoderMap
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 H264 decoder based on FFmpeg."vulkan_h264"(Required feature: vk-video ) - Hardware decoder. Requires GPU that supports Vulkan Video decoding.