Skip to main content

Interface: WebCodecsExportOptions

Defined in: src/export/WebCodecsExporter.ts:62

Options for configuring WebCodecs video export.

Properties​

alpha?​

optional alpha: boolean

Defined in: src/export/WebCodecsExporter.ts:93

Export with a transparent background, so the video carries an alpha channel to composite over other footage. Defaults to false.

Alpha needs the 'webm' format with the 'vp9' codec, because only that path carries an alpha side channel. When alpha is set and format/codec are not given, they default to 'webm' and 'vp9'. It also needs a Scene created with { alpha: true } (or backgroundOpacity < 1) and a browser that can encode VP9 with alpha. When any requirement is unmet, export() throws a clear error instead of producing opaque video that claims transparency. A transparent export keeps its audio: an Opus track next to the VP9 video.


audioBitrate?​

optional audioBitrate: number

Defined in: src/export/WebCodecsExporter.ts:114

Audio bitrate in bits per second. Defaults to 128_000.


audioManager?​

optional audioManager: AudioMixdownSource

Defined in: src/export/WebCodecsExporter.ts:112

An external AudioManager for the audio track. When not given, the scene's audioManager is used.


audioSampleRate?​

optional audioSampleRate: number

Defined in: src/export/WebCodecsExporter.ts:116

Audio sample rate in Hz. Defaults to 48_000 (Opus needs 48 kHz).


bitrate?​

optional bitrate: number

Defined in: src/export/WebCodecsExporter.ts:70

Target bitrate in bits per second. Defaults to 5_000_000.


codec?​

optional codec: WebCodecsVideoCodec

Defined in: src/export/WebCodecsExporter.ts:68

Video codec. Defaults to 'avc' for mp4 and 'vp9' for webm.


duration?​

optional duration: number

Defined in: src/export/WebCodecsExporter.ts:76

Duration in seconds. Auto-detects from the timeline if not specified.


format?​

optional format: "webm" | "mp4"

Defined in: src/export/WebCodecsExporter.ts:66

Container format. Defaults to 'mp4'.


fps?​

optional fps: number

Defined in: src/export/WebCodecsExporter.ts:64

Frames per second. Defaults to 60.


height?​

optional height: number

Defined in: src/export/WebCodecsExporter.ts:74

Output height in pixels. Defaults to scene height.


includeAudio?​

optional includeAudio: boolean

Defined in: src/export/WebCodecsExporter.ts:107

Include an audio track mixed down from the AudioManager. Defaults to true when the AudioManager has clips at the start of the export, else false.

In mp4 the track is AAC. The AAC encoder adds priming samples in front; the exporter keeps every source sample and writes an edit list that tells the player to skip the priming. A player that ignores mp4 edit lists plays the audio about 44 ms (2112 samples at 48 kHz) late.

In webm the track is Opus. webm-muxer writes no end trimming, so the decoded audio ends on a whole 20 ms Opus frame: up to 20 ms longer than the video, never shorter.


keyFrameInterval?​

optional keyFrameInterval: number

Defined in: src/export/WebCodecsExporter.ts:78

Frames between key frames. Defaults to the frame rate (one per second).


onProgress()?​

optional onProgress: (progress) => void

Defined in: src/export/WebCodecsExporter.ts:80

Progress callback (0-1).

Parameters​

progress​

number

Returns​

void


width?​

optional width: number

Defined in: src/export/WebCodecsExporter.ts:72

Output width in pixels. Defaults to scene width.