MKV Files with Subtitles, Alternate Languages and Video

Posted by JD 10/14/2010 at 18:15

These days, there is a real desire to have videos on your network, but not loose any of the features that the source media provides. Things like multiple languages tracks, director’s comments and other interesting audio tracks. I like to listen to the Spanish soundtrack and have the Spanish subtitles displayed for movies that I already know. It has been possible to have all this by ripping the full DVD contents and using an appropriate playback device for a long time, but that uses a bunch of storage – perhaps 4x more than needed if modern video codecs are used.

A few months ago, I discovered the MKV media container format. It lets us have video, multiple audio tracks and multiple subtitle tracks (text and bitmap-ed versions) within a single file. This is great, but how do you get everything into the MKV as easily as possible while retaining the quality that you want? Handbrake is the easiest solution that I’ve found so far.

There is a downside to using MKV containers. Windows Media Center doesn’t know what to do with these files. With a little internet searching, you can find an answer – last time I looked, the solution appeared to be worse than the problem. Fortunately, the WD TV-Live HD that I use loves MKV files and x.264 content. In fact, everything I suggest here works perfectly with that device and VLC. I suspect many other players will support the MKV extensions, but I simply cannot test beyond what I own.

Handbrake

Handbrake is a FLOSS, cross platform (Windows, Linux, OSX) video transcoding utility. It handles trancoding, cropping, scaling, subtitles and multiple audio tracks. I’d heard about it years ago, but was content with my PERL mencoder scripts. Lifehacker has covered it multiple times and the tool has always been voted highly in any of their Hive-5 polls. I was happy with my solution, so never bothered looking any further into Handbrake, until recently. I’d updated my PERL script to pull subtitles from TV shows (CC1, CC2, CC3) and include them in the transcoded x.264/MKV files. It was working fairly well and I’ll continue to use it for TV recorded content.

Recently I wanted to place some movies from optical media into an MKV, but retain multiple audio and subtitles. My efforts to accomplish this with mencoder were not moving quickly, so I searched a little and found that avidemux could handle the subtitles … even converting them from the bitmaps into real text as an SRT. The output SRT subtitle files are really impressive, but this is labor intensive. After converting a few subtitles into SRT files, I could see how much time this was going to take – another solution was needed.

Video – Quality

Handbrake does video transcoding is a very friendly way. Don’t worry about all the settings too much, just select your source and go to the Video tab and select the quality level. For DVD-quality, you want an RF of about 20 or Quality Level of 63%. Don’t use the bitrate or file size settings at all. Those are for people trying to get something to fit on a specific disk and aren’t really useful for x.264 users like us.

Don’t use MPEG2 or the OGG/Vorbis codecs unless you have a specific need.

Audio – Multiple Tracks

Handbrake lets you select multiple audio tracks to be included in the resulting MKV file. I always choose the highest quality DTS/AC3 files in English possible. For the settings, I select the passthru for those, since I really just want the exact copy of that track placed into the MKV. For the 2nd and later tracks, I select

  • Director’s Comments
  • Spanish
  • French
  • Mandarin Chinese
  • Any other connect tracks in English.

For the later 2 channel tracks, I force an MP3 audio down sample at 192 kbps. I leave the specific encoding type (Surround/Pro Logic/etc) as auto. To me, Surround Sound is good enough when I listen to a foreign language. With most content, only the main track in English gets the 5.1 (or better) audio anyway.

Subtitles

I started to love subtitles a few years ago. SRT files, which are text-based, are my preferred format and Handbrake works with them, but it will not currently provide them. You need to have another source. What Handbrake does do is rip the bitmapped subtitles from the original media and let you include those graphic files as subtitles in the MKV container. It is really very easy – just like with multiple audio tracks, we can include multiple subtitles and mix Closed Captioned and Bitmapped versions. I grab the same subtitles as for the audio tracks. Why not when it is this easy?

Extra Content

Most optical media will include some Bonus Features like the How it was made or some other background information. At this point, placing that content … with subtitles and mutli-track audio into the same MKV container doesn’t seems to be a good idea. For that reason, I usually treat the extra just like a main feature and do the audio and subtitles accordingly. Perhaps there’s a way to include multiple titles inside the same MKV, but how often do you really want to have all those extras online anyway? You still have the original disk after all.

If you have 8GB of MPEG2 content and use Handbrake as I’ve described, you can retain the same quality audio and video but have less than 2GB of storage needed. It really is impressive. With HD content the reduction in storage can drop from 40GB to 6GB easily. I understand that the Handbrake settings are a little different for HD content, but since I don’t have an optical player for HD-DVD or Blu-Ray, I can’t make any suggestions. I will be playing with OTA TV content transcoding in Handbrake over then next few weeks, but don’t expect any difficulties.

If I haven’t said this already, I use Handbrake on Windows7 and Linux. There are slight differences in the GUI, but nothing too difficult or challenging.

Trackbacks

Use the following link to trackback from your own site:
https://blog.jdpfu.com/trackbacks?article_id=819