If the input files all have identical codec settings, then you can merge them using mkvmerge.
Code:
$ mkvmerge -o output.mkv file1.mp4 + file2.mp4 + file3.mp4 + file4.mp4
This will get all the video, audio, srts, ass, subs, and other information from the files and append them perfect.
If they do not have the same codec settings (or have different resolutions, track ordering, etc), the only answer is to transcode them each into a single output. I'd do that with
Code:
$ cat files*mp4 | ffmpeg -i - {some settings} output.mp4
Bookmarks