ffmpeg merge audio and video code example
Example 1: ffmpeg add two videos together
$ cat mylist.txt
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4
Example 2: ffmpeg combine audio and video
ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a aac output.mp4
Example 3: ffmpeg add audio to video at specific time
ffmpeg -y -i a.mp4 -itsoffset 00:00:30 -i sng.m4a -map 0:0 -map 1:0 -c:v copy -preset ultrafast -async 1 out.mp4