How to create a multiple audio MKV from an AVI and a MP3 using FFMPEG

1

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

Eduardo Cobuci

Posted 2013-02-21T15:15:34.900

Reputation: 113

Answers

4

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).

evilsoup

Posted 2013-02-21T15:15:34.900

Reputation: 10 085