Node / Video Ffmpeg · guide
Transcode, trim & geometry
Current Apexify.js 6.0.0 documentation for Transcode, trim & geometry.
See also: Transcode & export presets · Timeline edits · Geometry.
convert
Re-encodes with CRF presets or explicit video bitrate.
| Option | Required | Notes |
|---|---|---|
outputPath | ✓ | Container inferred from extension (FFmpeg default muxer). |
format | — | Declared in types (mp4, webm, …) — not forwarded as -f in current convertVideo; rely on outputPath suffix (e.g. .webm). |
quality | — | low (-crf 28), medium (23), high (18), ultra (15). Default medium. |
bitrate | — | kbps video (-b:v …k) — wins over CRF when set. |
fps | — | -r output frame rate. |
resolution | — | -vf scale=w:h. |
Example — web-friendly MP4
Example — capped bitrate
trim
Stream copy slice (-c copy) from startTime for endTime - startTime seconds.
| Field | Notes |
|---|---|
startTime, endTime | Seconds (absolute end marker). |
outputPath | Destination path. |
Example
compress
CRF-based shrink or hard bitrate cap.
| Option | Notes |
|---|---|
quality | low … ultra maps to -crf + -preset (fast → veryslow). Default medium. |
maxBitrate | kbps triplet -b:v -maxrate -bufsize. |
targetSize | Present on type — not applied in compressVideo today (reserved). |
Returns { outputPath, success, originalSize?, compressedSize? }.
Example
rotate
Right-angle transpose + optional flips.
| Option | Values |
|---|---|
angle | 90, 180, 270 — transpose chain. |
flip | horizontal (hflip), vertical (vflip), both. |
outputPath | ✓ |
Example
crop
-vf crop=w:h:x:y (width/height/top-left).
changeSpeed
Video setpts, audio atempo chain when audio exists (chained atempo >2× / <0.5×).
| Field | Notes |
|---|---|
speed | >1 faster, <1 slower. |
outputPath | ✓ |
createTimeLapse
Alias → changeVideoSpeed with speed (default 10).
reverse
-vf reverse -af areverse — heavy; needs FFmpeg decode of full stream.
replaceSegment
Splices replacement media into [targetStartTime, targetEndTime] of source.
Exactly one replacement source:
| Mode | Fields |
|---|---|
| Clip from another video | replacementVideo, optional replacementStartTime, replacementDuration (defaults to gap length). |
| Frame sequence | replacementFrames (paths/buffers), replacementFps (default 30) → internal createVideoFromFrames. |
Validates window vs parent duration; concatenates part1 | replacement | part3 with -c copy.
Example — overlay B-roll
freezeFrame
Inserts a held still of time lasting duration seconds mid-timeline.
| Field | Notes |
|---|---|
time | Freeze capture instant (seconds). |
duration | Hold length on output. |
outputPath | ✓ |
Supports onProgress on final concat.