Using calculateMetadata
UsecalculateMetadata on a <Composition> to dynamically set duration, dimensions, and transform props before rendering.
Setting duration based on a video
Use thegetMediaMetadata() function from the mediabunny/metadata skill to get the video duration:
Matching dimensions of a video
Setting duration based on multiple videos
Setting a default outName
Set the default output filename based on props:Transforming props
Fetch data or transform props before rendering:abortSignal cancels stale requests when props change in the Studio.
Return value
All fields are optional. Returned values override the<Composition> props:
durationInFrames: Number of frameswidth: Composition width in pixelsheight: Composition height in pixelsfps: Frames per secondprops: Transformed props passed to the componentdefaultOutName: Default output filenamedefaultCodec: Default codec for rendering