In Linux, mkvmerge helps us to merge two or more than two multimedia files such as audio and video to combine it into one. mkvmerge command is part of mkvtoolnix package, hence we have to make sure it is installed first.
$ sudo apt install mkvtoolnix
Now, say we have two video files, video1.mkv and video2.mkv which we need to merge or concatenate into single file, then we can use the below command. This command takes the videos as input and generate the final output file with the name as mentioned with “-o” argument. i.e. here merged_video.mkv
$ mkvmerge -o merged_video.mkv video1.mkv \+ video2.mkv
Once this command is successful, you can see the single merged video will have video2.mkv appended at the end when video1.mkv is finished.
mkvmerge command supports much more feature than only merging videos, you can check the supported options using below command,
$ man mkvmerge