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

Node / Video Ffmpeg · guide

Audio tracks

Current Apexify.js 6.0.0 documentation for Audio tracks.

apexify.jsRuntime: nodeCURRENTSince 6.0.0

See also: Video audio operations (full) — normalizeAudio, mixAudio.

Multi-step edits: Video pipeline. Generated SFX: Advanced → createAudio → mux with mixAudio or pipeline .audio().


extractAudio

Demux first audio stream (requires audio track).

OptionDefaultNotes
outputPath✓Target file.
formatmp3mp3 (libmp3lame), wav (pcm_s16le), aac, ogg (libvorbis).
bitrate128kbps (-ab).
SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './talk.mp4',  extractAudio: {    outputPath: './talk.wav',    format: 'wav',  },});

removeAudio

Video-only output (-an -c:v copy).

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './with-sound.mp4',  removeAudio: { outputPath: './silent.mp4' },});

mute

ModeBehaviour
No rangesSame strip as removeAudio (-an).
ranges: [{ start, end }]volume=enable='between(t,...)':volume=0 segments on audio (-c:v copy).
SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './podcast.mp4',  mute: {    outputPath: './podcast-beeped.mp4',    ranges: [      { start: 30, end: 35 },      { start: 120, end: 125 },    ],  },});

mixAudio — MixAudioOperation

Mixes N overlay clips onto the output timeline while optionally keeping the original mix.

Top-level

FieldDefaultNotes
outputPath✓Mixed MP4 (-c:v copy, AAC 192k).
overlays✓MixAudioOverlayClip[] — see below.
keepOriginalAudiotruefalse → overlays only (no silent bed mixed under SFX — avoids quiet/muddy mixes).
originalVolume1Linear gain on [0:a] before amix.
originalSpeed1atempo chain (~0.25–4 clamp).
originalPitchSemitones0asetrate trick without rubberband.

MixAudioOverlayClip

FieldNotes
sourcePath / URL / Buffer (resolved like video).
startTimeSeconds on output timeline when clip begins.
durationSeconds from overlay after trim — default min(fileRemainder, videoEnd-start) logic inside helper.
sourceStartSkip seconds into overlay file (default 0).
volumeLinear gain (default 1).
speedatempo chain (~0.25–4) — changes playback speed of trimmed overlay audio.
pitchSemitonesasetrate + compensating atempo (duration-preserving, no rubberband).

Skips overlays whose playable window < ~0.04s or start past video end.

Example — bed music under narrator

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './voice.mp4',  mixAudio: {    outputPath: './voice-plus-bed.mp4',    keepOriginalAudio: true,    originalVolume: 1,    overlays: [      {        source: './music-loop.mp3',        startTime: 0,        duration: 120,        sourceStart: 5,        volume: 0.35,      },      {        source: './whoosh.wav',        startTime: 8.5,        duration: 1.2,        volume: 0.9,      },    ],  },});

Example — replace soundtrack entirely

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './reference.mp4',  mixAudio: {    outputPath: './rescored.mp4',    keepOriginalAudio: false,    overlays: [{ source: './score.mp3', startTime: 0 }],  },});

adjustVolume

Global mode (no ranges)

volume is percentage of unity (100 = unchanged) → volume={volume/100}.

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './quiet.mp4',  adjustVolume: {    outputPath: './boosted.mp4',    volume: 180,  },});

Interval mode (ranges)

Each range:

FieldNotes
start, endSeconds inclusive window (FFmpeg between(t,...)).
volumePercent /100 multiplier inside window.
speed, pitchSemitonesOptional — triggers rubberband filter substring (needs FFmpeg + librubberband).
SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './mix.mp4',  adjustVolume: {    outputPath: './ducked.mp4',    ranges: [      { start: 0, end: 10, volume: 100 },      { start: 10, end: 20, volume: 35 },      { start: 20, end: 9999, volume: 100 },    ],  },});

normalizeAudio

-c:v copy audio pipeline — video pixels unchanged.

For what each option does, LUFS vs peak, and honest limits of peak/rms, see Video audio operations (full).

SOURCEtypescript
typescript
Studio
await painter.createVideo({  source: './podcast.mp4',  normalizeAudio: {    outputPath: './podcast-loudnorm.mp4',    method: 'lufs',    targetLevel: -16,  },  onProgress: (p) => console.log(p.percent),});

Next steps