If all files are encoded with the same codecs, then this is easy to do. First combine the audio and video files, as you have already done, each pair of files is contained in one mkv. You can then combine them using concat demuxer as follows:
ffmpeg -f concat -i <(printf "file '%s'\n" ./file1.mkv ./file2.mkv ./file3.mkv) -c copy merged.mkv
or
ffmpeg -f concat -i <(printf "file '%s'\n" ./*.mkv) -c copy merged.mkv
You can also list one file per line in a text file called mergelist.txt (or whatever you call it), that is:
file './file1.mkv' file './file2.mkv' file './file3.mkv'
Then use this as input, a la:
ffmpeg -f concat -i mergelist.txt -c copy merged.mkv
This is the easiest and fastest way to do what you need, since it will not transcode files, just build them one by one.
source share