Skip to content
Apexify.jsDocs
Apexify.js version v5.4.5

Node / Video Ffmpeg · guide

Timeline edits

Current Apexify.js 6.0.0 documentation for Timeline edits.

apexify.jsRuntime: nodeCURRENTSince 6.0.0

Trim, splice, freeze, reverse, and speed changes on the timeline.

Several timeline steps in one project? Use videoPipeline() (advanced) instead of chaining createVideo calls.

Single operation: use the createVideo keys below (one per call).


trim

What it does: Copies [startTime, endTime] into a new file with stream copy (-c copy) — fast, no re-encode, but cuts must land on keyframes for frame-accuracy.

FieldEffect
startTimeWhere output starts (seconds).
endTimeWhere output ends — not duration; length = endTime - startTime.
outputPath✓
SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './livestream.mp4',  trim: {    startTime: 120,    endTime: 180,    outputPath: './highlight-2min.mp4',  },});

replaceSegment (splice)

What it does: Splices replacement footage into [targetStartTime, targetEndTime] of source, keeping head/tail. Same operation as videoPipeline().splice({ … }).

Modes

You provideBehaviour
replacementVideoTrims replacementStartTime for replacementDuration (default = gap length).
replacementFramesBuilds a temp clip at replacementFps (default 30) via createVideoFromFrames.

Cannot pass both replacementVideo and replacementFrames.

Options

FieldEffect
targetStartTime, targetEndTimeRegion replaced in main timeline (seconds).
replacementStartTimeIn-point inside replacement file (default 0).
replacementDurationLength taken from replacement (default matches gap).
replacementFpsFPS for frame sequence mode.
outputPath✓
SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './main.mp4',  replaceSegment: {    targetStartTime: 10,    targetEndTime: 25,    replacementVideo: './broll.mp4',    replacementStartTime: 0,    replacementDuration: 15,    outputPath: './main-with-broll.mp4',  },});

freezeFrame

What it does: Output = before clip + still image held duration seconds + after clip (concat).

FieldEffect
timeWhich frame to freeze (seconds).
durationHow long the freeze lasts on the output.
outputPath✓

Supports onProgress on final concat.

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './slides.mp4',  freezeFrame: {    time: 8,    duration: 2.5,    outputPath: './slides-pause.mp4',  },  onProgress: (p) => console.log(p.percent),});

reverse

What it does: Plays video backwards (-vf reverse -af areverse). CPU heavy, long runs on big files.

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './clip.mp4',  reverse: { outputPath: './clip-rev.mp4' },});

changeSpeed

What it does: setpts on video; atempo (possibly chained) on audio. >2× or <0.5× speed uses multiple atempo stages (FFmpeg limit 0.5–2 per stage).

FieldEffect
speed2 = double speed (half duration); 0.5 = slow motion.
outputPath✓
SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './slow.mp4',  changeSpeed: { speed: 2, outputPath: './fast-review.mp4' },});

createTimeLapse

What it does: Same helper as changeSpeed — speed defaults to 10 if omitted.

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './clouds.mp4',  createTimeLapse: {    speed: 30,    outputPath: './clouds-tl.mp4',  },});

Next steps