updateCompositionMetadata()v4.0.528
Updates width, height, FPS, or duration on a composition registration.
Draft API: This API is experimental and may change.
update-composition-metadata.tsimport {updateCompositionMetadata , typeCodemodProject } from '@remotion/codemods'; declare constproject :CodemodProject ; constresult =updateCompositionMetadata ({project ,compositionFile : 'src/Root.tsx',compositionId : 'MyComposition',metadata : {width : 1080,height : 1920}, });console .log (result );
Edits the registration props directly, replacing existing expressions for the specified fields. It does not execute or change calculateMetadata(), which may override those values at runtime.
<Still> registrations only support width and height overrides; supplying FPS or duration throws an error.
Options
project
An in-memory CodemodProject. The input project is not mutated.
compositionFile
The project file containing the composition registrations. Registration edits support <Composition>, <Still>, and <Folder> with static IDs or folder names. Aliased and namespace imports from remotion are supported.
compositionId
The static ID of the composition to edit.
metadata
A partial object containing the metadata fields to replace. Omitted fields are unchanged.
width?
A positive integer width in pixels. Omitted values are unchanged.
height?
A positive integer height in pixels. Omitted values are unchanged.
fps?
A positive, finite frame rate. Omitted values are unchanged.
durationInFrames?
A positive integer duration in frames. Omitted values are unchanged.
Return value
Returns an object with the following properties.
changes
An array of {filePath, previousContents, nextContents} file changes. A null content value indicates a created or deleted file.
nodePathRemappingsv4.0.530
An array of {filePath, oldNodePath, newNodePath} mappings. A null old path indicates an insertion; a null new path indicates removal. Apply these mappings to references from the input project. See node references.
updatedNodev4.0.530
The composition registration's node reference in the new project.
Errors
Throws when the target cannot be resolved, the requested edit is unsupported, or an option is invalid. Failed edits leave the input project unchanged.
Compatibility
| Browsers | Servers | Environments | |||||||
|---|---|---|---|---|---|---|---|---|---|
Chrome | Firefox | Safari | Node.js | Bun | Serverless Functions | ||||