MP4
An input type that allows Smelter to read static MP4 files.
Usage
To use MP4 Input you must register it first. You can do it by sending a request like this:
Example request
POST: /api/input/:input_id/registerContent-Type: application/json
{ "type": "mp4", "url": "https://example.com/video.mp4"}See HTTP Routes documentation to learn more about managing inputs.
Reference
Type definition
type Mp4Input = { type: "mp4"; url?: string; path?: string; loop?: bool; required?: bool; offset_ms?: f64; seek_ms?: f64; decoder_map?: DecoderMap; side_channel?: SideChannel;}Parameters for registering an MP4 file as an input.
Properties
url
URL of the MP4 file.
- Type:
string
path
Path to the MP4 file.
- Type:
string
loop
Specifies whether the input should be played in a loop.
- Type:
bool - Default value:
false
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:
bool - Default value:
false
offset_ms
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:
f64
seek_ms
Start playing from a specific timestamp in milliseconds. If loop is enabled, subsequent iterations start from the beginning. The input can also be seeked at runtime with the update input request.
- Type:
f64
decoder_map
Assigns which decoder should be used for media encoded with a specific codec.
- Type:
DecoderMap
side_channel
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
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: gpu-video ) - Hardware 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?: bool; audio?: bool; delay_ms?: f64;};Properties
video
Publish decoded RGBA video frames for this input on the side channel.
- Type:
bool - Default value:
false
audio
Publish decoded PCM audio batches for this input on the side channel.
- Type:
bool - Default value:
false
delay_ms
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:
f64 - Default value:
0