Browser FFmpeg recipe

Merge Audio and Video Online with FFmpeg

Pair a video stream with a separate audio track in a single MP4.

Command

Run this FFmpeg command

ffmpeg -i silent-video.mp4 -i track.m4a -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 audio-video.mp4

When to use it

  • silent video exports
  • music tracks
  • screen recordings

How it works

  1. Upload the silent video and audio track.
  2. Edit track.m4a if your audio file has a different name.
  3. Run the command and download the merged file.

Option reference

OptionWhat it does
-c:v copyKeeps the original video stream.
-c:a aacEncodes the audio to AAC for MP4 compatibility.
-map 0:v:0 -map 1:a:0Selects video from input 0 and audio from input 1.

Practical notes

  • If the audio is longer than the video, add -shortest to stop at the video end.
  • AAC audio works well for browser and phone playback.

FAQ

Is this different from add audio to video?

It is similar, but this page focuses on pairing a silent video with a separate track.

Why encode audio?

AAC is broadly compatible with MP4 players and upload platforms.