LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

mkvmerge

creates Matroska files

TLDR

Merge files
$ mkvmerge -o [output.mkv] [input1.mp4] [input2.mp4]
copy
Add subtitles
$ mkvmerge -o [output.mkv] [video.mkv] [subtitles.srt]
copy
Extract tracks
$ mkvmerge -o [output.mkv] --audio-tracks [1] [input.mkv]
copy
Set default track flag
$ mkvmerge -o [output.mkv] --default-track-flag [0:1] [input.mkv]
copy
Split by size
$ mkvmerge -o [output.mkv] --split [700M] [input.mkv]
copy
Set track language
$ mkvmerge -o [output.mkv] --language [0:eng] [input.mkv]
copy
Add title
$ mkvmerge -o [output.mkv] --title "[Movie Title]" [input.mkv]
copy
Identify tracks in a file
$ mkvmerge -i [input.mkv]
copy

SYNOPSIS

mkvmerge [options] -o output inputs

DESCRIPTION

mkvmerge creates Matroska (MKV/MKA/MKS) container files by merging video, audio, and subtitle streams from various source formats. It does not transcode; it only remuxes streams into the Matroska container.The tool is part of MKVToolNix. Track IDs can be found with mkvmerge -i or mkvinfo. Option order matters: global options first, then per-file options before the input file they apply to.

PARAMETERS

-o FILE

Output file.
INPUTS
Input files.
-i FILE
Identify tracks, codecs, and properties of input file.
--audio-tracks IDS
Select audio tracks to include.
--video-tracks IDS
Select video tracks to include.
--subtitle-tracks IDS
Select subtitle tracks to include.
--no-audio
Exclude all audio tracks.
--no-subtitles
Exclude all subtitle tracks.
--language TID:LANG
Set language for a track (ISO 639-2 code).
--default-track-flag TID:BOOL
Set or clear the default track flag.
--split SIZE|duration:TIME|chapters:all
Split output by size, duration, or chapters.
--title TEXT
Set segment title.
--append-to SPEC
Append tracks from one file after another.
-l, --list-types
List supported source file formats.

CAVEATS

Does not transcode (remux only). Part of MKVToolNix. Option order matters: per-file options must precede the input file they apply to. Track IDs are zero-indexed.

HISTORY

mkvmerge is part of MKVToolNix, providing Matroska container manipulation tools.

SEE ALSO

Copied to clipboard
Kai