Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

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.