You can edit Matroska (MKV) files with the help of freeware program MKVToolnix. It allows to create, split, merge MKV videos and extract video / audio from MKV without recompression, therefore it is possible to preserve the original quality. Click here to download the free software from the official web site.
MKV is the file extension of the Matroska container format (like AVI, MP4). Such containers combine video, audio, subtitles in one file. Video and audio streams are compressed with appropriate codecs. Matroska is a free container format (open standard). The main advantage of Matroska is the large number of supported codecs: MPEG1, MPEG2, MPEG4, H.264, WMV, HEVC, Theora, AAC, DTS, AC3, FLAC, Vorbis, WAV, MP3 etc. MKV container may include unlimited number of audio, video and subtitle tracks in a single file.
What is MKVToolnix?
MKVToolnix is a tool for muxing and demuxing MKV (joining and separating streams). The program lists all audio and video tracks contained in an MKV video. Audio tracks as well as any existing subtitles are listed separately. With a click of a mouse you can switch off a soundtrack, load a new one, or extract sound in Matroska audio format MKA. You can also split existing MKV files, merge video clips, use subtitles (SUP, SSA, SRT, PGS) and divide video into chapters. The tool can be used via the graphical user interface and in command line mode.
Actually, MKVToolnix is a small collection of programs for editing MKV files (MKVMerge, MKVInfo, MKVExtract, MKVPropEdit; the core of the collection is the MKVMerge GUI). Chapter Editor allows to create new sections or change existing chapters. You can also insert new audio and subtitle tracks. MKVInfo shows the detailed information about your MKV files.
There are two different packages you can install:
mkvtoolnix - command line tools.
mkvtoolnix-gui - tools with graphical user interface.
Command line tools can be used inside shell scripts (Linux) or inside batch files, Powershell scripts (in Windows).
Which command-line tool to use?
mkvmerge - to combine files in a MKV container.
mkvextract - to extract video, audio, subtitle files from any MKV container without quality loss.
mkvpropedit - to edit properties of the MKV container.
mkvinfo - to get information about the MKV container.
You can read documentation explaining how to use each of these tools:
Documentation for MKVMerge
Documentation for MKVInfo
Documentation for MKVExtract
Documentation for MKVPropEdit
This graphical program simplifies creation of MKV files. You just need to specify two tracks -- video and audio files as the source files, and the output file. A Matroska file is created by clicking on the Start Muxing button. Another feature is the conversion of any other container file into Matroska format. The integrated help of the graphical user interface via F1 contains a very detailed help file.
Backward compatibility: IE4+