This blog post will explain how to use FFMPEG to combine a video and audio stream into one video. This method will only work on audio and video streams encoded as mp4 files. The two streams are of the same length also. The command will use the audio stream file audioout.mp4 and the video stream file videoout.mp4 as input files. The flag -map [0] will assign the audio to channel 0. The flag -map [1] will assign the audio to channel 1. The file output.mp4 will be the result of the command that was executed.
ffmpeg -i audioout.mp4 -i videoout.mp4 -map [0] -map [1] output.mp4
In case an mp3 audio stream needs to be combined by an mp4 video stream. The command below will use the audio stream audioout.mp3 and the video stream file videoout.mp4 as input files. The -c:v copy and -c:a aac will copy the streams to output.mp4.
ffmpeg -i videoout.mp4 -i audioout.mp3 -c:v copy -c:a aac output.mp4
