Skip to main content

getEncodableAudioCodecs()

warning

Very experimental feature - expect bugs and breaking changes at any time.
Track progress on GitHub and discuss in the #web-renderer channel on Discord.

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.

Example usage
tsx
import {getEncodableAudioCodecs} from '@remotion/web-renderer';
 
const codecs = await getEncodableAudioCodecs('mp4');
console.log(codecs); // e.g. ['aac', 'opus'] or ['opus'] on Firefox

Arguments

container

string WebRendererContainer - required

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

options?

object GetEncodableAudioCodecsOptions

Optional configuration object.

audioBitrate?

number | string WebRendererQuality

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"

note

AAC encoding is not supported in Firefox. On Firefox, only ["opus"] will be returned for both containers.

See also