I was just wondering how to add audio while keeping the pre-existing audio on the video intact: I have done some research and it seems there was a similar question here:
So I'm looking at using this code segment taken from slhck:
ffmpeg -i input.mp4 -i input.wav -c:v copy -map 0:v:0 -map 0:a:0 -map 1:a:0 -c:a:0 copy -c:a:1 aac -b:a 192k output.mp4
As slhck said the audio codec wav is incompatible with mp4 so it must be re-encoded, however I just want to make sure the video is not re-encoded, which I think is happening, because ffmpeg is doing the process at 200x speed.
Edit: The only problem is there are two different audio streams and I was thinking if I could have one combined audio stream (mixing the two together).
Edit: With the help of a very generous reddit user I have managed to combine the two streams into one through the amix-filter. And it now works!
ffmpeg -i input.mp4 -i input.wav -filter_complex [0:a:0][1:a:0]amix=inputs=2:duration=longest[aout] -c:v copy -map 0:v:0 -map [aout] -c:a aac -b:a 192k output.mp4