FFmpeg Cookbook
JA

Add BGM / Audio Mix Tool

Add background music or sound effects to a video and mix them with the original audio. Fade in/out and loop are built in.

Your file is not uploaded
Video file
MP4 / MOV / WebM
BGM audio
MP3 / WAV / AAC / M4A / OGG
Original audio volume 100%
BGM volume 50%
If the source video has no audio, the BGM automatically becomes the only audio track — turn on looping if the BGM is shorter than the video.
Processing… 0%

Equivalent FFmpeg command

CLI command for your current settings. Updates live as you change controls.

ffmpeg -i video.mp4 -stream_loop -1 -i audio.mp3 -filter_complex "[0:a]volume=1.000[a0];[1:a]volume=0.500,afade=t=in:st=0:d=2.00,afade=t=out:st=8.00:d=2.00[a1];[a0][a1]amix=inputs=2:duration=first:dropout_transition=2[aout]" -map 0:v -map "[aout]" -t 10 -c:v copy -c:a aac -b:a 192k -movflags +faststart output.mp4
Popular uses
Add background musicMix with narrationTune fades

How to use

  1. Pick a video and BGMDrop the video and the audio track separately.
  2. Set the mix balanceThe defaults are 100% original and 50% BGM. Lower the BGM if the video has speech.
  3. Configure fades and loopFades default to 2 seconds. If the BGM is shorter than the video, leave looping on “Auto-loop to match video length”.
  4. Run the mixDownload once the preview shows up.

Recommended settings

Vlog / explainer with narration
Original 100% / BGM 25% · fade 2s · loop on
Keeps narration clear, and the BGM does not run out in long clips.
Music-only edit (no original audio)
Original 0% / BGM 80% · fade 2s
Removes the original sound so only the music plays.
Short video with music from the first second
Original 70% / BGM 100% · fade 0s
With a 0-second fade-in, the BGM starts at full level.

When it goes wrong

BGM ends before the video

Cause: The BGM is shorter than the video and looping is set to “No loop”.

Fix: Choose “Auto-loop to match video length”.

Distortion / clipping

Cause: A volume above 100% pushes the loud parts past the limit.

Fix: Go back to 100% or less. To make the whole mix louder, use the Volume Normalizer.

The fade-out does not happen

Cause: The fade-out is timed to the end of the video. If a non-looping BGM ends before the video, it just stops.

Fix: Turn looping on, or use a BGM longer than the video.

Questions

Where can I find royalty-free BGM?

YouTube Audio Library, Free Music Archive, Pixabay Music and Bensound are options. Check each site for commercial-use and credit rules.

How do I mute the original audio?

Set Original audio volume to 0%. Only the BGM remains.

Can I sequence multiple BGM tracks?

One BGM per run. Join the tracks into one file first, for example with the Audio Joiner.

Audible click at loop boundaries

The loop point gets no fade. Use a track made for seamless looping.

Mono BGM?

Yes. If the original audio is stereo, the output is stereo. If only the BGM is used, or the original audio is mono too, the output stays mono.

Output format?

MP4. The video is copied without re-encoding; only the audio is rebuilt as AAC 192 kbps.

More detail (settings, limits, FFmpeg commands)

What each setting means

Original volume
0–200%. 0% removes the original sound and leaves only the BGM. When mixing, both tracks are halved before being added, so 100% sounds quieter than the source.
BGM volume
0–200% (default 50%). Lower it to keep speech audible.
Fade in / out
Length of the BGM fade at the start and at the end (0–10 seconds). The fade-out is timed to the end of the video.
Loop BGM
Repeats a BGM that is shorter than the video. On by default.
Output length
“Match video length” or “Match shorter input”. With the shorter input, the video ends where a non-looping BGM ends.

Browsers and limits

  • Maximum file size: video 500 MB / BGM 100 MB
  • Audio formats: MP3 / WAV / M4A / AAC / Ogg / FLAC
  • The video is copied into MP4 without re-encoding, so video that MP4 cannot hold (VP8 WebM, for example) causes an error

The same job with the FFmpeg command line

Mix BGM with the original audio
ffmpeg -i video.mp4 -i bgm.mp3 -filter_complex "[0:a]volume=1[a0];[1:a]volume=0.3,afade=t=in:st=0:d=2,afade=t=out:st=58:d=2[a1];[a0][a1]amix=inputs=2:duration=first[a]" -map 0:v -map "[a]" -c:v copy out.mp4
volume=0.3 sets the BGM to 30%, and afade adds 2-second fades. st=58 is 2 seconds before the end of a 60-second video; change it to fit yours. amix halves each input before adding them.
Loop a short BGM under a longer video
ffmpeg -i video.mp4 -stream_loop -1 -i bgm.mp3 -filter_complex "[0:a]volume=1[a0];[1:a]volume=0.3[a1];[a0][a1]amix=inputs=2:duration=first[a]" -map 0:v -map "[a]" -c:v copy -shortest out.mp4
-stream_loop -1 repeats the BGM; -shortest stops at the end of the video.