After merging an mpeg-4 video with the srt subtitles the resulting mkv has the wrong length

mp4 file ist 51min3sec and the mkv is 1:41:16.

I use windows 11 and mkvtoolnix gui version 79.0

Welcome!

The issue is that at least one of the subtitle entries has either a really huge start timestamp or a really huge duration. The resulting file’s duration is the difference between highest timestamp of all frames + its corresponding duration minus lowest timestamp of all frames.

Just edit your subtitles, find the offending entry or entries & fix them before multiplexing them with the source file.