AVI (Audio Video Interleave) is a container format Microsoft introduced in 1992 as part of Video for Windows. It was built for a world of CD-ROMs and low-resolution codecs, and that origin still shows: the original AVI spec has a 32-bit size field that causes corruption or forced splitting past roughly 2 GB unless the OpenDML extension is used, it has no native concept of chapters or multiple subtitle tracks, and variable frame rate video — extremely common in modern phone and screen recordings — is stored awkwardly because AVI expects a fixed frame interval. None of that is a problem with the codec inside the file; it is a limitation of the wrapper around it.
MKV (Matroska) was designed from scratch in the mid-2000s to fix exactly these gaps. It can hold any video or audio codec, any number of subtitle tracks in any format (including styled ASS/SSA subtitles), chapter markers, attached fonts, and cover art, all indexed in a way that survives file corruption far better than AVI's linear index. This tool converts your AVI file to MKV using a direct stream copy — the video and audio data is not re-encoded, decoded, or recompressed, it is simply repackaged into the Matroska container structure. That means the conversion is nearly instant regardless of file length, and the output is bit-for-bit identical in picture and sound quality to your original AVI.
Once you have an MKV, you can trim or compress it, or go the other way with MKV to AVI if you need the original format back.