Installation of MKVToolNix Matroska tools on Ubuntu Linux

With the tools provided in MKVToolNix, one can get information about Matroska files (with mkvinfo), extract tracks and data from Matroska files (with mkvextract) and create Matroska files (with mkvmerge) from other media files. Matroska is an open source multimedia file format aiming to become the new container format for the future. With MKVToolNix, users can edit and create MKV files with ease.

In this tutorial, we will be covering the step by step instructions to install the MKVToolNix package on an Ubuntu Linux system. All steps will be performed on the command line only. Afterwards, we will go over a few example commands so you can start to understand how to use the tools and commands provided with MKVToolNix.

In this tutorial you will learn:

  • How to install the MKVToolNix package on Ubuntu Linux
  • How to use the commands included with MKVToolNix to edit and view info about MKV files
Installation of MKVToolNix Matroska tools on Ubuntu Linux
Installation of MKVToolNix Matroska tools on Ubuntu Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu Linux
Software MKVToolNix
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Installation of MKVToolNix on Ubuntu Linux step by step instructions




Follow the step by step instructions below to get MKVToolNix installed on Ubuntu Linux, and then begin using the commands that come with the package to begin creating or editing Matroska (MKV) files.

  1. MKVToolNix is easy to install on Ubuntu Linux because it resides within the official software repositories for the system. Simply open a command line terminal and type the following commands to get MKVToolNix installed via the apt package manager:
    $ sudo apt update
    $ sudo apt install mkvtoolnix
    
    Installing the MKVToolNix software package via apt command on Ubuntu Linux
    Installing the MKVToolNix software package via apt command on Ubuntu Linux

    Now that the software has been installed, we will have access to numerous Linux commands such as mkvextract, mkvinfo, mkvmerge, and mkvpropedit. Let’s see how to use some of them.

    NOTE
    If you do not already have some MKV files to experiment with, you can get some sample files by navigating to this website. This will allow you to test out some of the newly installed commands.
  2. The mkvinfo can tell us information about the MKV file such as what tracks (video, audio, subtitles, chapters, etc) that it contains, as well as any metadata.


    $ mkvinfo video.mkv
    
    Checking the track info and metadata for an MKV file by using the mkvinfo command
    Checking the track info and metadata for an MKV file by using the mkvinfo command
  3. The mkvextract command can be used to extract different “tracks” from the MKV file. For example, the video track, audio track, subtitles, chapters, etc. Let’s see how to extract the first audio track from a video file. We will name the extracted audio track as audio.ogg:
    $ mkvextract tracks video.mkv 1:audio.ogg
    
    Extracting the audio track from an MKV file using the mkvextract command
    Extracting the audio track from an MKV file using the mkvextract command
  4. We can use the mkvpropedit command to view property information for an MKV file as well as edit most of the property values without the need to perform a complete remux of the MKV file. For example, to see a list of properties and their values for an MKV file:
    $ mkvpropedit -l video.mkv
    

    Listing all property values for an MKV file in Ubuntu

  5. The mkvmerge command is used to combine multiple tracks into a single Matroska MKV file. In other words, we can combine our video track and audio track into a single file. We can also include a subtitles file, chapters file, tags, and other supported track files. As an example, we will take a video track from an AVI file and combine it with subtitles that are in an SRT file. The result will be an MKV file with both tracks combined:
    $ mkvmerge -o video.mkv --subtitles 0:subs.srt old_video.avi
    

Closing Thoughts




In this tutorial, we saw how to install MKVToolNix Matroska tools on an Ubuntu Linux system. We also saw how to use the tools and commands that come with the application in order to extract data, edit property info, view metadata information, and merge multiple tracks into MKV files.