Skip to content

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/register
Content-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;
video_decoder?: "ffmpeg_h264" | "vulkan_video";
}

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

video_decoder

The decoder to use for decoding video.

  • Type: "ffmpeg_h264" | "vulkan_video"
  • Default value: ffmpeg_h264
  • Supported values:
    • "ffmpeg_h264" - Use the software decoder based on ffmpeg.

    • "vulkan_video" (Required feature:vk-video ) - Use hardware decoder based on Vulkan Video.

      This should be faster and more scalable than the ffmpeg decoder, if the hardware and OS support it.

      This requires hardware that supports Vulkan Video. Another requirement is this program has to be compiled with the vk-video feature enabled (enabled by default on platforms which support Vulkan, i.e. non-Apple operating systems and not the web).