packages/docs/docs/renderer/select-composition.mdx
Evaluates the list of compositions from a Remotion Bundle by evaluating the Remotion Root and evaluating calculateMetadata() on the specified composition.
If you want to get a list of all compositions, use getCompositions().
If no composition with the specified ID exists, then this function will throw.
// ---cut---
import {bundle} from '@remotion/bundler';
import {selectComposition} from '@remotion/renderer';
const bundled = await bundle({entryPoint: require.resolve('./src/index.ts')});
const composition = await selectComposition({
serveUrl: bundled,
id: 'MyComposition',
inputProps: {},
});
console.log(composition.id); // "MyComposition"
console.log(composition.width, composition.height);
console.log(composition.fps, composition.durationInFrames);
Accepts an object with the following properties:
serveUrlA string pointing to a Remotion Bundle generated by bundle() or a URL that hosts the the bundled Remotion project.
idThe ID of the composition you want to evaluate.
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().
logLevel?port?Prefer a specific port that will be used to serve the Remotion project. If not specified, a random port will be used.
chromiumOptions?See: Chromium Flags
timeoutInMilliseconds?A number describing how long the render may take to resolve all delayRender() calls before it times out. Default: 30000
browserExecutable?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.
onBrowserLog?Gets called when your project calls console.log or another method from console. See the documentation for renderFrames for more information.
puppeteerInstance?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().
:::
envVariables?An object containing environment variables to be injected in your project.
mediaCacheSizeInBytes?<AvailableFrom v="4.0.352"/>offthreadVideoCacheSizeInBytes?<AvailableFrom v="4.0.23"/>offthreadVideoThreads?<AvailableFrom v="4.0.261"/>binariesDirectory?<AvailableFrom v="4.0.120" />chromeMode?<AvailableFrom v="4.0.248" />onBrowserDownload?<AvailableFrom v="4.0.137" />