Browser FFmpeg recipe

Mix Audio with Video Online with FFmpeg

Keep the video and mix its original sound with another audio track.

Command

Run this FFmpeg command

ffmpeg -i video.mp4 -i music.mp3 -filter_complex [0:a][1:a]amix=inputs=2:duration=first:dropout_transition=2[a] -map 0:v -map [a] -c:v copy -c:a aac mixed-audio.mp4

When to use it

  • background music
  • voice plus music
  • demo sound beds

How it works

  1. Upload the video and extra audio file.
  2. Change music.mp3 to your second audio filename.
  3. Run FFmpeg and download the mixed output.

Option reference

OptionWhat it does
amix=inputs=2Mixes two audio streams together.
duration=firstKeeps the output aligned to the first input duration.
-map 0:v -map [a]Uses the original video and mixed audio output.

Practical notes

  • Lower the music volume first if it overpowers the original audio.
  • Mixing audio requires re-encoding the output audio stream.

FAQ

Can I use this for background music?

Yes. Upload the video and music file, then map the music as the second input.

Will the video be re-encoded?

No, this command copies the video stream and re-encodes only the mixed audio.