packages/docs/docs/renderer/get-compositions.mdx
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().
const getCompositions: (serveUrlOrWebpackUrl: string, options?: GetCompositionsConfig) => Promise<TComposition[]>;
serveUrlOrWebpackUrlA string pointing to a Remotion Bundle generated by bundle() or a URL that hosts the the bundled Remotion project.
options?An object containing one or more of the following options:
inputPropsOptional in v4.x, required from v5.0.
Input Props to pass to the selected composition of your video..
Must be a JSON object.
From the root component the props can be read using getInputProps().
You may transform input props using calculateMetadata().
puppeteerInstance?<AvailableFrom v="3.0.0" />An already open 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.
:::note
Despite the name, not actually compatible with puppeteer, only with openBrowser().
:::
browserExecutable?<AvailableFrom v="2.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?<AvailableFrom v="3.0.0" />Gets called when your project calls console.log or another method from console. A browser log has three properties:
text: The message being printedstackTrace: 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, verboseinterface ConsoleMessageLocation {
/**
* URL of the resource if known or `undefined` otherwise.
*/
url?: string;
/**
* 0-based line number in the resource if known or `undefined` otherwise.
*/
lineNumber?: number;
/**
* 0-based column number in the resource if known or `undefined` otherwise.
*/
columnNumber?: number;
}
type BrowserLog = {
text: string;
stackTrace: ConsoleMessageLocation[];
type: 'log' | 'debug' | 'info' | 'error' | 'warning' | 'dir' | 'dirxml' | 'table' | 'trace' | 'clear' | 'startGroup' | 'startGroupCollapsed' | 'endGroup' | 'assert' | 'profile' | 'profileEnd' | 'count' | 'timeEnd' | 'verbose';
};
const getCompositions = (options: {onBrowserLog?: (log: BrowserLog) => void}) => {};
// ---cut---
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?<AvailableFrom v="2.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
port?Prefer a specific port that will be used to serve the Remotion project. If not specified, a random port will be used.
logLevel?<AvailableFrom v="4.0.0"/>chromiumOptions?<AvailableFrom v="2.6.5" />Allows you to set certain Chromium / Google Chrome flags. See: Chromium flags.
offthreadVideoCacheSizeInBytes?<AvailableFrom v="4.0.23"/>mediaCacheSizeInBytes?<AvailableFrom v="4.0.352"/>offthreadVideoThreads?<AvailableFrom v="4.0.261"/>binariesDirectory?<AvailableFrom v="4.0.120" />onBrowserDownload?<AvailableFrom v="4.0.137" />chromeMode?<AvailableFrom v="4.0.248" />ffmpegExecutableremoved in v4.0
An absolute path overriding the ffmpeg executable to use.
ffprobeExecutable?removed in v4.0
An absolute path overriding the ffprobe executable to use.
Returns a promise that resolves to an array of available compositions. Example value:
[
{
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.