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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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