Back to Remotion

getEncodableAudioCodecs()

packages/docs/docs/web-renderer/get-encodable-audio-codecs.mdx

4.0.5011.3 KB
Original Source

Part of the @remotion/web-renderer package.

Returns the audio codecs that the current browser can encode for a given container format.

Use this function to dynamically show users which audio codecs are available in their browser.

tsx
import {getEncodableAudioCodecs} from '@remotion/web-renderer';

const codecs = await getEncodableAudioCodecs('mp4');
console.log(codecs); // e.g. ['aac', 'opus']

Arguments

container

string <TsType type="WebRendererContainer" source="@remotion/web-renderer" /> - required

The container format: "mp4" or "webm".

options?

object <TsType type="GetEncodableAudioCodecsOptions" source="@remotion/web-renderer" />

Optional configuration object.

audioBitrate?

number | string <TsType type="WebRendererQuality" source="@remotion/web-renderer" />

A number (bits per second) or quality preset ("very-low", "low", "medium", "high", "very-high").

Return value

Returns a Promise<WebRendererAudioCodec[]> - an array of audio codec identifiers that the browser can encode.

Possible values: "aac", "opus"

See also