Skip to main content

splitSequences()v4.0.528

Splits supported timing elements into two adjacent nodes.

warning

Draft API: This API is experimental and may change.

split-sequences.ts
import {splitSequences, type CodemodProject, type NodeReference} from '@remotion/codemods'; declare const project: CodemodProject; declare const node: NodeReference; const result = await splitSequences({ project, splits: [{node, frame: 45}], }); console.log(result);

Adjusts from, durationInFrames, and trimBefore. Timing must be static; dynamic timing and spreads that may override it are rejected. Supported expressions such as 4 * fps are kept when the new value can be written in the same form exactly. The media file itself is unchanged.

Options​

project​

An in-memory CodemodProject. The input project is not mutated.

splits​

An array of split requests. A node may appear once per call; requests may span files.

node​

The node reference of a Remotion sequence, interactive element, or supported timeline media element.

frame​

The frame at which to split, in the same parent timeline coordinate system as the node's from prop. It must be finite and strictly inside the sequence. Fractional frames are supported.

videoConfig?v4.0.533​

The composition's width, height, fps, and durationInFrames. Supply these to interpret supported timing expressions using useVideoConfig(). By default, those runtime values are unknown.

Return value​

A promise resolving to 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.

nodePathRemappings​

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.

insertedNodes​

References to the new second halves. Each first half keeps its original identity, with any path change listed in nodePathRemappings.

Errors​

Throws or rejects when the target cannot be resolved, the requested edit is unsupported, or an option is invalid. Failed edits leave the input project unchanged.

Compatibility​

BrowsersServersEnvironments
Chrome
Firefox
Safari
Node.js
Bun
Serverless Functions

See also​