Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to merge an audio file (.wav or .au format) with a video file (.mp4 format).

Please suggest me how to achieve this. I want to merge these file to new .mp4 video file. An ffmpeg command would be very welcome.

share|improve this question
There's a decent article here that might be helpful too... – Simon East Feb 8 '14 at 2:57
up vote 63 down vote accepted

See this example, taken from this blog entry but updated for newer syntax. It should be something to the effect of:

ffmpeg -i video.mp4 -i audio.wav \
-c:v copy -c:a aac -strict experimental output.mp4

You should transcode the audio in some way, since MP4s cannot have PCM audio streams. You can use a desired audio codec if you want. See the AAC Encoding Guide for more info.

If your input video already contains audio, and you want to replace it:

ffmpeg -i video.mp4 -i audio.wav \
-c:v copy -c:a aac -strict experimental \
-map 0:v:0 -map 1:a:0 output.mp4

The map option makes ffmpeg only use the first video stream from the first input and the first audio stream from the second input for the output file.

share|improve this answer
I tried it but ffmpeg is freezing while merging – Sandy May 1 '11 at 11:41
i don't think mp4 containers can have wav audio streams. Try ffmpeg -i audio.wav -i video.mp4 -acodec copy -vcodec copy -f mkv output.mkv – Luke Mar 12 '13 at 23:29
I am using this and it is replacing the origional audio from the input audio. What if I want to merge input audio with the audio of input video? – Iqbal Malik Jan 31 '14 at 7:00
Very sweet command lines... – Chandra Nakka Sep 3 '14 at 4:37
Great, I used ffmpeg -i video.mp4 -i audio.wav \ -c:v copy -c:a aac -strict experimental output.mp4 to merge MP3 with Wav file...=> mp4 5 minutes, rendered 30 seconds..Thanks – sonida May 24 '15 at 18:55

Since I am not allowed to write comments to the first answer with my reputation, an addendum here, because I had this problem when encoding webms.
If your audio stream is for example longer than the video stream, you have to cut it or otherwise you will have the last video frame as a still image and audio running.

To cut either stream, you can use -ss [hh:mm:ss] -t [ss] before each of the -i "file.ext".
-ss [...] will define the starting point to cut
-t [...] will define the length of the segment in seconds


ffmpeg.exe -ss 00:00:10  -t 5 -i "video.mp4" -ss 0:00:01 -t 5 -i "music.m4a" -map 0:v:0 -map 1:a:0 -y out.mp4
share|improve this answer
You can also just use -shortest to cut the end. – nyuszika7h Mar 25 at 15:22

This actually worked for me :

ffmpeg.exe -i AudioT.m4a -i VideoT.mp4 -acodec copy -vcodec copy muxed.mp4

share|improve this answer

-open command promt (windows+r ->cmd->enter)

-then go to inside the folder where you have audio and video file

apply this cmd

ffmpeg -i "videoFile.mp4" -i "audioFile.mp3" -shortest outPutFile.mp4 will get a new file named outPutFime.mp4 (a merged file of audio and video)

share|improve this answer
It's really not necessary to describe how to use the command line here. It's pretty much implied that users will be able to figure that out. Especially since the asker specified FFmpeg. All the same, the -shortest tag is very nifty. Much simpler than in @user136036's answer. – Kat May 14 '15 at 17:08
This will re-encode everything, which is probably not what is wanted. – mivk Nov 2 '15 at 22:00

Try using mencoder (Yes it is ffmpeg based, but you never know). I use the -audiofile argument. I generally use ffmpeg, though, so take this advice with a pinch of salt.

And, if you use Windows, Mediacoder (not open source anymore sadly) works... its basically a frontend for a lot of gnu encoders and a few non-free ones.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.