matroska + vobsub + subtitles … finally!

Oh, man, this is something I’ve been struggling to wrap my brain around for a good while, and I finally got it figured out. I’ve always wanted to be able to add subtitles to my matroska videos … no real reason other than it’d be nice. I don’t normally turn them on, but I do occasionally. The problem I kept running into was the same with a lot of software documentation out there — it was just sparse or assumed you knew some certain terms or skipped over explanations. Adding to the complexity is the fact that there are a few subtitle formats that different containers can handle.

In my setup, I’m once again skipping a few steps to just plain keep this simple, mostly at the cost of space, though even that is hardly anything. As an example, on a 1.5 GB MPEG2, the resulting VobSub file is 1 MB. I can live with that.

Anyway, here’s what I have so far … and I promise to update the Gentoo wiki as soon as I get time to cover this more in detail. The first step is to rip the subtitles from the DVD. To do that you have to calculate the subtitle index, which I won’t go into right now. On the DVD I used, “It’s the Great Pumpkin, Charlie Brown” it was the first (and only) subtitle track for the movie, so it was pretty easy for me.

In fact, here’s the command I used to rip both the movie and the subtitles at once:

$ mencoder dvd://1 -ovc copy -oac copy -vobsubout subtitles -vobsuboutindex 0 -sid 0 -o pumpkin.avi

This created three files: pumpkin.avi (the unencoded MPEG2), subtitles.idx and subtitles.sub.

After that, and this is where I never realized how easy it is, to dump it all into Matroska, you just add the .idx file along with the others you are going to mux.

$ mkvmerge -o pumpkin.mkv pumpkin.avi subtitles.idx

When watching the movie with MPlayer, you can toggle through the possible subtitles with the ‘j’ key.

I can’t believe it was as simple as that.

About these ads

2 Comments

Filed under Gentoo, Matroska, Multimedia

2 responses to “matroska + vobsub + subtitles … finally!

  1. hieu

    You may want to check out doom9.org. Also, there are ways to convert the subtitle into another format which mplayer would load automatically if it is named with the same name (minus the .ext).

    Just thought I’d mention something (potentially) helpful (for further digging into the matter). Sorry if it clutters up. Feel free to delete this comment.

  2. Steve

    Heh, no problem. I’m all about taking the most simplistic route possible, regardless of how much space it has. The fact of the matter is, with all the DVD issues out there, there isn’t a magic bullet that will correctly work with everything. So for me keeping as close to the source as possible is the most error-free way to go. The only problem is you have to have about 3 TB handy. Ah well.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s