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

GitHubLicenseContactTermsPrivacy

From the blog

All posts →Automating Social Media Captions: A Developer's Guide to Frame-Perfect SubtitlesMastering Programmatic Video Transitions: A Developer's GuideThe Video Markdown Pattern: Turning Static Content into Automated MP4sZero-Cost Video Rendering: How to Export MP4s Directly in the BrowserBuilding an AI Video Agent: How to Generate MP4s from LLM Prompts with VideoJSONAutomating E-commerce: How to Generate 1,000 Product Videos with TypeScriptThe Blueprint for Automated Video: Building a Reusable Component LibraryBuilding a Video-First SaaS: Embed a Multi-Track Editor in 10 Lines
© 2026 VideoFlow. Apache-2.0 core.