Matroska (MKV)

The “Matroska”:Wikipedia:Matroska container has been gaining enough momentum over the past few years for me to consider using it as both a long-term archival format and a flexible way to rip my DVD collection into some kind of appliance that is kid-resistant (there’s nothing worse for CDs or DVDs than an insistent toddler who wants to hear/see something for the umpteenth time – neither media is truly scratch-proof, let alone kid-proof).

Also, it allows for multiple audio and subtitle streams, so I can watch stuff in native audio without subtitles if I wish to but have those options available for the kids and not waste time and storage doing duplicate rips. Plus it’s trivially remuxed into straight-up MP4 for the Apple TV as needed.


Date Link Notes
Nov 7 mkvdts2ac3 A bash script (local copy) that makes it easier to quickly convert “DTS”:Wikipedia:DTS audio tracks into “AC3”:Wikipedia:AC3 for payback in devices such as some LG TV sets and the Apple TV. Most of the dependencies (linked below) can be trivially gotten off MacPorts.
mkvtoolnix The core toolset, available in MacPorts
libdca DTS”:Wikipedia:DTS to WAV converter, also available in MacPorts
aften The reciprocal WAV to “AC3”:Wikipedia:AC3 encoder, which requires cmake from MacPorts to build. I recommend doing:
cmake .. -DCMAKE_INSTALL_PREFIX:STRING="/opt/local/"
…to integrate it fully.



Converting an MPEG transport stream to .mkv is mostly easy. Here’s a crash course on how demux the video and audio streams using mencoder and remux them (this becomes insanely complex when dealing with subtitles and specific audio streams, but friends have been using a variation of this to deal with their AVCHD camcorders):

mencoder input.m2ts -of rawvideo -ovc copy -o output.mp4 -nosound
mencoder input.m2ts -of rawaudio -o output.wav -oac copy -ovc frameno
mkvmerge -o output.mkv output.mp4 output.wav

Exactly the same principle can be applied for remuxing into multi-track MP4 envelopes.

Getting QuickTime to open .mkv files with Perian

Edit Library/Preferences/ and add a video/x-matroska child to WebPluginMIMETypes (the easiest way is to duplicate an existing entry), making sure to set the mkv extension inside WebPluginExtensions.