Skip to main content

getCompositions()

Part of the @remotion/renderer package.

Gets a list of compositions defined in a Remotion project based on a Remotion Bundle by evaluating the Remotion Root.

For every compositions their calculateMetadata() function is evaluated. If you just want to evaluate one composition that you want to render, use selectComposition().

ts
const getCompositions: (
bundleOrServeUrl: string,
options?: GetCompositionsConfig,
) => Promise<TComposition[]>;
ts
const getCompositions: (
bundleOrServeUrl: string,
options?: GetCompositionsConfig,
) => Promise<TComposition[]>;

Arguments

bundleOrServeUrl

A string pointing to a Remotion Bundle generated by bundle() or a URL that hosts the the bundled Remotion project.

options?

optional

An object containing one or more of the following options:

inputProps?

optional

Define custom props that can be retrieved using getInputProps() at runtime. Useful for setting a dynamic duration or dimensions for your video.

puppeteerInstance?v3.0.0

optional

An already open Puppeteer Browser instance. Use openBrowser() to create a new instance. Reusing a browser across multiple function calls can speed up the rendering process. You are responsible for opening and closing the browser yourself. If you don't specify this option, a new browser will be opened and closed at the end.

browserExecutable?v2.3.1

A string defining the absolute path on disk of the browser executable that should be used. By default Remotion will try to detect it automatically and download one if none is available. If puppeteerInstance is defined, it will take precedence over browserExecutable.

onBrowserLog?v3.0.0

optional

Gets called when your project calls console.log or another method from console. A browser log has three properties:

  • text: The message being printed
  • stackTrace: An array of objects containing the following properties:
    • url: URL of the resource that logged.
    • lineNumber: 0-based line number in the file where the log got called.
    • columnNumber: 0-based column number in the file where the log got called.
  • type: The console method - one of log, debug, info, error, warning, dir, dirxml, table, trace, clear, startGroup, startGroupCollapsed, endGroup, assert, profile, profileEnd, count, timeEnd, verbose
tsx
getCompositions({
// ...
onBrowserLog: (info) => {
console.log(`${info.type}: ${info.text}`);
console.log(
info.stackTrace
.map((stack) => {
return ` ${stack.url}:${stack.lineNumber}:${stack.columnNumber}`;
})
.join("\n"),
);
},
});
tsx
getCompositions({
// ...
onBrowserLog: (info) => {
console.log(`${info.type}: ${info.text}`);
console.log(
info.stackTrace
.map((stack) => {
return ` ${stack.url}:${stack.lineNumber}:${stack.columnNumber}`;
})
.join("\n"),
);
},
});

timeoutInMilliseconds?v2.6.3

A number describing how long one frame may take to resolve all delayRender() calls before the [render times out and fails(/docs/timeout). Default: 30000

logLevel?v4.0.0

One of verbose, info, warn, error. Determines how much is being logged to the console.
verbose will also log console.log's from the browser.

chromiumOptions?v2.6.5

optional

Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.

offthreadVideoCacheSizeInBytes?v4.0.23

From v4.0, Remotion has a cache for <OffthreadVideo> frames. The default is null, corresponding to half of the system memory available when the render starts.
This option allows to override the size of the cache. The higher it is, the faster the render will be, but the more memory will be used.
The used value will be printed when running in verbose mode.
Default: null

ffmpegExecutable

removed in v4.0, optional

An absolute path overriding the ffmpeg executable to use.

ffprobeExecutable? v3.0.17

removed in v4.0

An absolute path overriding the ffprobe executable to use.

Return value

Returns a promise that resolves to an array of available compositions. Example value:

ts
[
{
id: "HelloWorld",
width: 1920,
height: 1080,
fps: 30,
durationInFrames: 120,
defaultProps: {
title: "Hello World",
},
},
{
id: "Title",
width: 1080,
height: 1080,
fps: 30,
durationInFrames: 90,
defaultProps: undefined,
},
];
ts
[
{
id: "HelloWorld",
width: 1920,
height: 1080,
fps: 30,
durationInFrames: 120,
defaultProps: {
title: "Hello World",
},
},
{
id: "Title",
width: 1080,
height: 1080,
fps: 30,
durationInFrames: 90,
defaultProps: undefined,
},
];

The defaultProps only get returned since v2.5.7.

See also