MKVToolNix 9.2.0, codenamed photograph, was released on May 28, 2016. It’s a collection of tools to create, alter and inspect Matroska (MKV) files, available on Linux, BSD and Windows. This tutorial shows how to install MKVToolNix on Ubuntu 16.04, Debian 8, Linux Mint, Elementary OS via official deb repository.
The free and open source (GPLv2) MKVToolNix is a collection of the following command line and graphical utilities:
- mkvextract: extract tracks from Matroska files into other files
- mkvmerge: merge multimedia streams into a Matroska file
- mkvinfo: print information about elements in Matroska files
- mkvinfo-text: print information about elements in Matroska files
- mkvpropedit: modify properties of existing Matroska files without a complete remux
- mkvinfo-gui: a graphical interface to print information about elements in Matroska files
- mkvtoolnix-gui: a GUI for mkvmerge including a chapter and a header editor
Install MKVToolNix 9.2.0 on Ubuntu 16.04 LTS
It is included in Debian and Ubuntu repositories, but if you want to install the latest stable version, use the upstream repository. First, run the following command to import the GPG signing key.
wget -q -O - https://mkvtoolnix.download/gpg-pub-moritzbunkus.txt | sudo apt-key add -
The GPG key is imported when you see an OK message. Then edit the sources.list file with nano or your favorite text editor.
sudo nano /etc/apt/sources.list
Append the following two lines at the end of this file.
deb http://mkvtoolnix.download/ubuntu/xenial/ ./ deb-src http://mkvtoolnix.download/ubuntu/xenial/ ./
Save and close the file. Now update local package index and install MKVToolNix 9.2.0.
sudo apt-get update sudo apt-get install mkvtoolnix mkvtoolnix-gui
Now it can be launched from Unity Dash.
Install MKVToolNix 9.2.0 on Ubuntu 14.04, Linux Mint 17, Elementary OS Freya
The process is largely the same, just replace the codename xenial with trusty.
wget -q -O - https://mkvtoolnix.download/gpg-pub-moritzbunkus.txt | sudo apt-key add - echo "deb http://mkvtoolnix.download/ubuntu/trusty/ ./" | sudo tee -a /etc/apt/sources.list sudo apt-get update sudo apt-get install mkvtoolnix mkvtoolnix-gui
Install MKVToolNix 9.2.0 on Debian 8 Jessie
wget -q -O - https://mkvtoolnix.download/gpg-pub-moritzbunkus.txt | sudo apt-key add - echo "deb http://mkvtoolnix.download/debian/jessie/ ./" | sudo tee -a /etc/apt/sources.list sudo apt-get update sudo apt-get install mkvtoolnix mkvtoolnix-gui
Use mkvinfo to Inspect Matroska Files
mkvinfo a command line utility to print information about elements in Matroska files. The simple command is:
It will show elements info in a tree mode.
You may like to use it with
sudo apt-get install mediainfo mediainfo filename.mkv
Extract Elements from MKV Files with mkvextract
mkvextract can extract tracks, tags, attachments, chapters, CUE sheets, time codes and cues from mkv files.
To extract audio and video tracks, use the following command.
mkvextract tracks source-file.mkv <track-ID>:<output-file>
Track ID can be known with mkvmerge.
mkvmerge -i source-file.mkv
Notice that track ID begins from 0.
It can also extract subtitles, simply provide the track ID of subtitle. The following track types are supported.
H.264/AVC, RealVideo, Theora, VP8/VP9, MP2, MP3, AC3, raw PCM, AAC, OGG Vorbis, TrueAudio, ALAC, FLAC, WavPack, Opus, SSA, ASS, Kate, VobSub, and USF.
How to Use mkvmerge
If you have a video file of any format and a subtitle file, then you can use mkvmerge to add subtitle to the video. For example, to merge a MP4 file with a SRT file:
mkvmerge -o output-file.mkv input.mp4 input.srt
What you got is a MKV file with embedded subtitle. To add multiple language subtitles, just add each SRT files incrementally. You can also merge audio files with video files.
In VLC media player, you can choose one of the subtitles by right-clicking the video, then select Subtitle > Sub_Track. And select your subtitle. There’s also an option to disable subtitle.
Comments, questions or suggestions are always welcome. If you think this post is useful, ? please share it with your friends on social media! Stay tuned for more Linux tutorials.