AfterDawn.com

Creating MKV files with mkvtoolnix



Matroska (MKV) files have become a popular container for storing various types of video and audio, but perhaps most commonly AVC video with Dolby Digital (AC-3) audio. The primary reasons for this are the need for a standard container more adavanced (with better cross-platform support) than AVI which can handle streams from different sources equally well. Although currently consumer electronics support in devices like standalone DVD players is lacking, for HTPCs, and even some mobile devices it's becoming more common.

Muxing vs Encoding


This guide requires that you have your video and audio already encoded and ready for muxing. MKV isn't a type of compression, but rather a container that holds whatever video and audio you have. If you don't already have video and audio prepared to be muxed you should do that first.


Why MKV?


Unlike the older and Windows-based AVI container, MKV is designed to handle features found in all modern encoders like B frames, as well as being portable across most operating systems. Unlike the MPEG-PS, MPEG-TS, and MP4 containers standardized for MPEG-2 and MPEG-4 it treats all types of audio equally instead of classifying some as standard streams and others as private. Support for audio streams in MPEG containers may be limited to those mandated by the associated MPEG container, which is why AC-3 audio can't generally be used in the MP4 container. In an MKV container all streams supported by your playback or other video related software are treated equally. Compared to MPEG-2 TS (Transport Streams), the Matroska container is more widely supported in media players, or as a source for editing and encoding programs.

MKV and DTV Captures


MKV files are most commonly used for DTV captures. DTV is generally captured as a MPEG-TS stream, containing the original MPEG-2 video and AC-3 audio from the source broadcast. Those streams can be muxed into a MKV file either directly from the capture, or after editing of some kind. The MPEG-2 video is often re-encoded to AVC in order to save space, which is where the real importance of MKV comes in. Since AVC's native container, MP4, treats the AC-3 audio used for standard DTV boradcasts as a private stream it's not well supported in either software or hardware. Most of the time AAC audio is expected in this container. Because AAC hasn't really caught on as an audio standard for video applications many people prefer to keep the AC-3 format, which means using a different container like MKV.


Compatibility


Although not universal, support for MKV files is fairly standard for other video related software, from players to editors and encoders. With a combination of the Haali Media Splitter (formerly Matroska Media Splitter) and ffdshow most video and audio combinations are supported by just about any software that uses Microsoft's DirectShow architecture. In some cases it's even useful to mux video and audio streams to MKV simply so they can be loaded in other programs. Super, for example doesn't accept elementary MPEG-2 video streams, but will accept the same video muxed into a Matroska container.


Required Software


Haali Media Splitter

Allows opening (splitting) MKV files through DirectShow

mkvtoolnix

Includes mkvmerge muxing tool for MKV file creation

Optional Software

ffdshow

For decoding video and audio in MKV files

VLC for Windows, Linux, or OS X (Intel)

Media player with built-in MKV support



Next: Installing software




More About Matroska


Matroska's MKV "universal" Container is described by its developers as "the extensible open standard Audio/Video Container." This translates to a multimedia Container designed to support practically any type of video or audio stream you might care to use.... read more in the Glossary

Table of Contents

  1. 1. Introduction
  2. 2. Installing Software
  3. 3. Muxing with mkvmerge
Written by: Rich Fiscus