This Does Not Compute

Technology, gaming, music and things that just don't compute

Undoing Ordered Chapters, Part 3: Attaching Fonts

mkvmerge-fonts

 

Here’s yet another problem I recently ran across when dealing with MKV files and subtitles. I had separate video and subtitle files that I needed to combine into one so I could run them through Handbrake, but when I checked out the final file, the subtitles were nowhere to be found. Thus, another lesson in dealing with MKV files is in order.

Quick background: Most MKV files you’ll run across will already have subtitles muxed into them (such as with anime fansubs). Sometimes, though, subbers will release only the subtitle file itself and leave the task of sourcing the video to the viewer.

I ran across one of these recently. The subtitle file was in .ass format (remember those, from Part 2 of this series?), and I quickly figured out how to use MKVToolnix to combine it and the separate MKV video file I had. And indeed, when I opened it in VLC, everything played great.

But when I dropped the file into Handbrake and selected the subs to be burned in (as I usually do), they never showed up on screen. They were able to be selected in the subtitle list, and Handbrake seemed to be going through the motions, but they just weren’t there.

After a few hours of trial and error, I figured out what was missing: the fonts.

Remember the “styles” section of the .ass file we had to edit in Part 2? It referenced the name, size, color, etc of the fonts used in the subtitles. One of the features of the MKV container is that you can jam attachments in it, and a common use of this feature is to attach the fonts that the subtitles use in the event the player doesn’t have them available (such as if they’re uncommon fonts).

Turns out that while VLC will refer to the fonts installed on your computer if they’re not available in the MKV file, Handbrake will not. Handbrake apparently requires that the fonts used in SSA/ASS subtitles be attached to the MKV. Thus, the reason why the subs didn’t show up for me — the fonts weren’t attached, so Handbrake just skipped them.

Thankfully, fixing the problem is quite easy. Just follow these steps (you should be familiar with the mechanics of doing these things from Part 2 by now; if not, go read through it):

  1. Open the SSA/ASS subtitle file in TextEdit or similar, and make note of the font names in the Styles section. Do they all look familiar? If you have them all installed on your computer, then skip to step 2. Otherwise, edit the names of the fonts to match ones that you do have access to (e.g. change Verdana to Arial).
  2. Make copies of all the TrueType or OpenType font files referenced by the subtitle file. Fonts in OS X are stored in /Library/Fonts by default, so you can go digging through there, or just open Font Book and choose Show in Finder from the right-click menu on the fonts you need. Option-drag (to copy) them to a temporary folder where you have all your other subtitle and video files for processing.
  3. Open op MKVToolnix. Click Add, then select your video file. Click Add again, and select the corresponding SSA/ASS subtitle file.
  4. Flip to the Attachments tab and click Add. Attach your fonts one by one. Then, in the Attachments list, edit the name of each font to match how it was referenced in the subtitle file (e.g. change Arial.ttf to Arial). See the above screen shot for details.
  5. Click Start Muxing and it’ll pull everything together for you. Repeat for each additional file/episode/whatever.
  6. Rock on with Handbrake as usual.
Advertisements

Comments are closed.

%d bloggers like this: