VideoFlowcodeGitHubTry itCoreRenderersReact Video EditorPlaygroundExamplesDocscodeGitHubTry it
Example

Video with audio

Mix a video layer and a ducking music track.

#video#audio
// Video on a music bed: the audio track fades in alongside the video.
// Demonstrates `addAudio`, `addVideo`, audio `transitionIn: 'fade'` (which
// targets `volume` on auditory layers), and `waitFor: 'finish'`.
const $ = new VideoFlow({
  name: 'Video with Audio',
  width: 1920,
  height: 1080,
  fps: 30,
});

// Audio layer — `transitionIn: 'fade'` ramps `volume` from 0 → its set value.
const music = $.addAudio(
  { },
  {
	source: 'https://videoflow.dev/samples/sample.mp3',
	transitionIn: { transition: 'fade', duration: '1s' },
  },
);

// `waitFor: 'finish'` makes the outer flow wait for the clip's full source
// duration before moving on — auto-detected from the file when omitted.
const video = $.addVideo(
  { fit: 'cover', volume: 1 },
  { source: 'https://videoflow.dev/samples/sample.mp4' },
  { waitFor: 'finish' },
);

return $;
Compiling00:00
play_arrowOpen in playgroundcodeSource on GitHub← All examples
VideoFlow

Open-source toolkit for composing videos from code.

Product

CoreRenderersReact Video EditorPlayground

Learn

DocsAPI referenceExamplesvs. Remotionvs. FFmpeg

Project

GitHubLicenseContact

Legal

TermsPrivacy
© 2026 VideoFlow. Apache-2.0 core.