Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 have a AVI movie and a second audio in a MP3 file and want to create a third file in MKV with the original audio from AVI and a secondary audio from the MP3. Is it possible to do with FFMPEG? I've tried this command but the output MKV was created without the secondary audio:

ffmpeg -y -i movie.avi -i sec_audio.mp3 -c:v libx264 -b:v 3000k -c:a libmp3lame -b:a 256k final.mkv
share|improve this question
up vote 4 down vote accepted
ffmpeg -i input.avi -i sound.mp3 -map 0 -map 1 -c copy output.mkv

-map 0 -map 1 tells ffmpeg to take all the streams from input 0 (input.avi in this example) and all the streams from input 1 (sound.mp3 in this example). See this page on the ffmpeg wiki (a very useful general resource for ffmpeg usage) for more information.

I've used -c copy to simply copy all the streams, since MKV can contain anything (in terms of delivery codecs) that AVI can contain. Of course, you can use whatever output options you want (again, take a look at the ffmpeg wiki for more information).

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .