How to play MKV on your GNU / Linux distribution

MKV format logo

MKV or Matroska is an open video container format, therefore do not confuse it with a codec, because it is not. The format is quite popular today for being able to contain large amounts of video and audio, even image tracks and subtitles in a single file. Thus it is intended to be a universal storage format for audiovisual and multimedia media. But if your distribution does not have the necessary packages, you will find that you cannot play these types of videos.

Some distributions include these packages among the restricted ones that are not installed by default or simply that you cannot even find them in the your distro repositories, in other cases they are installed by default. You will also already know the benefits of the fantastic VLC multimedia player, which supports a multitude of formats and always makes life easier when it comes to playing different formats and codecs.

Play MKV via VLC:

Chromecast VLC Player

Although there are other players with which to view MKV in addition to many other video formats, I always advise you to choose the VLC player as it is one of the best multimedia players and in addition to having many references on the official MKV sites to the player, guaranteeing us that it will work properly without problems. That does not mean that other players do not work well, if you prefer you could opt for SMPlayer, which also plays MKV.

Well, you will need VLC installed on your distributionWhile it is certainly not the only Linux-compatible video player that can play MKV, it is the best and, I believe, the favorite of most of our readers. You can install the program by downloading it from the official website of VideoLAN or making use of the package manager of your distribution, because it will surely be in the repositories as it is so popular.

Once installed, you may find that playing .mkv videos still does not work, and this is because you will also need a number of additional packages with the necessary libraries. For example, if you use a Debian or Ubuntu based distro, you can do it with:

sudo apt-get -y install mkvtoolnix mkvtoolnix-gui

If even installing these packages does not work for you, check that you have thethe appropriate codecs in each case. For example, in some cases if you use Ubuntu you may also need the ubuntu-restricted-extras package or directly search for the codec and download it from the official website, install a codec-pack, etc. For example, for Ubuntu you should run the following commands:

sudo apt-get -y install aptitude

sudo aptitude -y install ubuntu-restricted-extras

In case of using Ubuntu in a more modern version or if you are interested in knowing the name of the package for the different flavors From Ubuntu, you can use the following command to locate the exact package name for the default restricted extras where certain required codecs are found:

apt seach --names-only -- -restricted-extras

Install codecs:

As I said at the beginning, MKV is not a codec video as some think. We have to differentiate between container formats, codec and file format. The file is represented by the icon of the video in question, that is, it is a data set that can be found in a file system. But within that file there is a container that will contain the information or content, in this case it would be the image and sound data that make up the video. Finally we have the codec, which is nothing more than an algorithm for encoding and decoding the content of the container. Codecs can be for both audio and sound.

Therefore, even if we have a player compatible with MKV and the extension of the .mkv file is perfectly recognized, we may find that we cannot play a video in question, and that is because the content cannot be decompressed and decoded properly, since our system does not have that algorithm capable of deciphering it. For example, we can find a video that is seen but not heard (codec missing audio) or heard but not seen (video codec missing).

There are many, but lthe most common codecs that we can find for MKV and that we must have installed for it to work properly are: mp3, divx, mp4, h.261, h.262, xvid, etc. Some of them can be found among the restricted packages that we talked about earlier in the distros, or in packages like W32Codecs for Linux.

If we have all this going, everything should work properly. By the way, if you don't know the codec that an audio or video file has, you can use programs like media info, which would be the equivalent of Windows GSpot to obtain codec information. You can download it from the Official site or install it with the package manager of your distro, since it is usually in the repos.

For its installation using the universal method, once we access the website and download the tarball, we can make it work with:

<pre class="bbcode_code">tar xjvf Mediainfo.tar.bz2</pre>
<pre class="bbcode_code">sudo mv MediaInfo_CLI_GNU/MediaInfo /usr/local/bin/</pre>

If in the previous step we did not pass it to the binaries directory as we have done, we would have to execute it from where we have it, but thus for its handling we simply we invoke followed by the name of the file To check:

mediainfo mivideo.mkv

Once you get the information of the necessary audio and video codecs it is easier to search the net for how you can download the specific package for your distro and install it. In the Video # section you will find the necessary codec for video and in Audio # for sound.

Do not forget to leave your comments with your suggestions and doubts ...

The content of the article adheres to our principles of editorial ethics. To report an error click here.

2 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Max said

    "Codecs can be for both audio and sound."
    Should I say "video" in either of the two

  2.   George Fabian Mandoudis said

    Excellent, I congratulate you.
    Thanks, very well explained and very complete and how to find the codec.
    very thankful.
    carry on like this.