MKVToolnix -- Cross-platform tools for Matroska

Source code and compilation

If you want to compile the tools yourself then you must first decide if you want to use a 'proper' release version or the current development version. As both Matroska and MKVToolNix are under heavy development there might be features available in the Git source code repository that are not available in the releases. On the other hand the Git source code repository version might not even compile.

Requirements

In order to compile MKVToolNix you need a couple of libraries. Most of them should be available pre-compiled for your distribution. The libraries you absolutely need are:

Other libraries are optional and only limit the features that are built. These include:

libmatroska and libebml

Start with the two libraries. Either get libebml 0.7.8 and libmatroska 0.8.1 or a fresh copy from the Subversion repository.

svn co https://svn.matroska.org/svn/matroska/trunk/libebml
svn co https://svn.matroska.org/svn/matroska/trunk/libmatroska

Change to libebml/make/linux and run make staticlib. If you have root-access then run make install_staticlib install_headers as root in order to install the files. Change to libmatroska/make/linux. Once more run make staticlib. If you have root-access then run make install_staticlib install_headers as root in order to install the files.

MKVtoolNix

Either download the release 2.9.7 and unpack it or get a fresh copy from my Git source code repository by running the following command:

git clone git://git.bunkus.org/mkvtoolnix.git

You can also browse the Git repository online.

The source code for all older releases is available from the sources directory.

Additional step if you're using the development version: change to the mkvtoolnix directory and run ./autogen.sh which will generate the configure script. The autoconf needs to be installed for this step.

If you have run make install_staticlib for both libraries then configure should automatically find the libraries' position. Otherwise you need to tell configure where the libmatroska and libebml sources are:

./configure \
  --with-extra-includes=/where/i/put/libebml\;/where/i/put/libmatroska \
  --with-extra-libs=/where/i/put/libebml/make/linux\;/where/i/put/libmatroska/make/linux
  

Now run make. You can create a Matroska file with mkvmerge -o output.mkv input1.avi input2.ac3 input3.ogg ...

At the moment the following sources are supported (this list is OUTDATED):

MPlayer

Since April 30, 2003 MPlayer's 'main' CVS module contains my Matroska demuxer. It is also present in the official releases marked as mplayer 1.0pre1 and later. Version 1.0pre5 and newer contain a new Matroska demuxer that doesn't even need libebml and libmatroska anymore. Head over to www.mplayerhq.hu and get a fresh copy of the current release or MPlayer's CVS version. Remember: Neither the stable module '0_90' nor the official releases 0.9x contain the demuxer.

Additional information about compiling MPlayer itself can be found in its documentation.

Playback of Matroska files is as simple as playing other files. Just run mplayer file.mkv. You can select the audio and subtitle tracks by using mplayer's -aid, -alang, -sid and -slang options. The two ID options count the number of tracks from 0 on - e.g. the first subtitle track found has the -sid 0. If the tracks have their language code set (ISO639-2 language codes) then you can also use the -alang, -slang options. Example: mplayer -slang ger movie.mkv.

mplayer will also print some information about the Matroska files and the tracks found in it upon playback. That way you can easily see which options you'll have to use for specific tracks. Example:

[mkv] Track ID 1: video (V_MS/VFW/FOURCC), -vid 0
[mkv] Track ID 2: audio (A_MPEG/L3), -aid 0, -alang eng
[mkv] Track ID 3: audio (A_VORBIS), -aid 1, -alang ger
[mkv] Track ID 4: subtitles (S_TEXT/UTF8), -sid 0, -slang eng
[mkv] Track ID 5: subtitles (S_TEXT/UTF8), -sid 1, -slang ger