Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have got two video files: .mp4, with a single (incorrect) audiostream, and an .mkv, with two audio streams (one incorrect, the other correct)

Is there a way to replace the audio of the .mp4 file with the second stream in the .mkv?

Thanks

share|improve this question
add comment

1 Answer

You'd need to extract the audio from the MKV first and then combine remux the MP4 with the new track. Something like this should work:

ffmpeg -i vid.mkv -acodec copy -vn audio.ext
ffmpeg -i vid.mp4 -i audio.ext -vcodec copy -acodec copy -map 0:1 -map 1:0 final.mp4
share|improve this answer
    
Hey, I extracted the audio properly using ffmpeg -i vid.mkv -map 0:2 -ac 2 aud.wav but still can't merge it with the mp4 file for some reason... –  CookieMonster Aug 11 '11 at 11:37
add comment

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.