Mp4
A component that renders content of Mp4 file. It is simpler alternative to the InputStream
component that does not require registration, but with more limited set of options.
Usage
import { Mp4, Rescaler } from "@swmansion/smelter";import Smelter from "@swmansion/smelter-node";
function ExampleApp() { return ( <Rescaler> <Mp4 source="https://example.com/video.mp4" /> </Rescaler> );}
22 collapsed lines
async function run() { const smelter = new Smelter(); await smelter.init();
await smelter.registerOutput("output", <ExampleApp />, { type: "mp4", serverPath: "./output.mp4", video: { encoder: { type: "ffmpeg_h264", preset: "ultrafast", }, resolution: { width: 1920, height: 1080, }, }, });
await smelter.start();}void run();
Example output
Reference
Type definitions
type Mp4Props = { source: string; volume?: number; muted?: boolean;}
Props
source
Url or local path to the mp4 file. Note that the path has to be local to the machine where Smelter server runs.
- Type:
string
volume
Audio volume of the input stream. Accepts values between 0 and 1.
- Type:
number
- Default value: 1
muted
Determines whether to mute audio of the input stream.
- Type:
boolean
- Default value:
false