Use this step-by-step guide to combine a video file and a separate audio file with FFmpeg.
Install FFmpeg (if not already installed):
sudo apt-get install ffmpegbrew install ffmpegPrepare your files
Place your files in one folder, for example:
video.mp4audio.mp3Then open a command prompt or terminal in that folder.
Merge video and audio
Run this command:
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -shortest output.mp4
-c:v copy-c:a aac-shortestIf your audio is longer than your video, the result will not run longer than needed.