Subtitles in ELAN and beyond

ELAN is a tool for creating complex annotations on video and audio resources. It’s great for doing the hard work of annotation, but less ideal as a way of displaying the result, for example in a presentation. This brief tutorial covers a common use case: displaying a short stretch of video material with subtitles overlayed on the image. The instructions below are geared towards Windows users, although Mac users can also benefit from ELAN-exported .srt subtitles using VLC Media Player or Quicktime + Perian.

What you need

  1. The latest version of ELAN, which has improved support for subtitles
  2. Vobsub, a tool that overlays subtitles on videos. (I’m told Perian does the same for Quicktime on Mac.)
  3. SubResync (included in Vobsub) for editing subtitle settings (changing fonts, editing size and placement).1

In what follows I am presuming that you have installed these three tools. Not strictly necessary, but recommended for testing is VLC Media Player, an open source multimedia player that handles subtitles quite well.

Extract media clip

First we’ll want to extract a media clip. Select the stretch of video you want and make a new annotation (I always have a tier ‘selections’ for this kind of annotations). Note down the begin and end timecodes and extract the clip with your favourite video editing application. If you have M2-edit-cl, ELAN can do the job for you: choose File > Export as > Media Clip. (If you don’t have M2-edit-cl or there is a configuration error, this option will be greyed out.) Save the clip in a place where you can easily find it. Let’s say it’s called gunpowder.mpeg.

Export the subtitles

Then we want the subtitles. Maintain the selection of your annotation and take the following steps:

  1. Choose File > Export as > Subtitles text...
  2. In the ‘select tiers’ box, check the tiers you want to use as subtitles.
  3. Under ‘Output options’, check the box ‘Restrict to selected time interval’.
  4. Uncheck ‘add master media time offset to annotation times’.
  5. Click OK.
  6. In the following window, navigate to the folder where you saved the media clip. Give the subtitle file the same filename as your media clip, except for the extension. In my example, this would be gunpowder.srt.
    N.B. It is essential that your subtitles and your media clip reside in the same folder and have the same filename.
  7. Last step: select the encoding. UTF-8 will do in most cases, but for special characters you’ll have to change this later. If your annotations have no special characters you may also choose ISO-8859-1.
  8. Now click ‘Save’.

That’s it, you’re done.

Okay, now you have a media clip and a subtitles file. If Vobsub is installed correctly, it will automatically display the subtitles in any application that uses the Windows Media framework. This means you’ll see subtitles overlayed on your video image in ELAN and in multimedia players like VLC, Winamp, and Windows Media Player. That’s a good start and it may be enough for most of you.

But what about special characters?

If you use special characters in your annotations (e.g. IPA symbols), you may find that they go awry. There are two reasons for this. First of all, Vobsub expects a slightly different encoding, namely the Windows version of UTF-16. Secondly, Vobsub uses Arial as its default font, and that font doesn’t include all special characters.

Fixing the first one is easy.2 Go to your subtitles file in Windows Explorer, right-click and select ‘Open with…’. In the list, select ‘Notepad’. Now Notepad, a simple text editor, has opened your .srt file and you can see how simple it is (just timecodes and text, really). In Notepad, go to File > Save as… . Don’t change the filename, but do change the Encoding. It probably says ‘UTF-8’ (since that’s what we chose when we exported the subtitles in ELAN). Change the encoding to ‘Unicode’ and save the file. Yes, you want to overwrite it.

Change to a Unicode-compliant font

For the second problem, there are multiple solutions. One is to change the font online in Vobsub. In your system tray (near the clock) you will see a green arrow indicating Vobsub activity while playing subtitled video files. Right-click this and select ‘Direct Vobsub’. This will bring up a window where you can change the font (under ‘Text Settings’). Change it to Arial Unicode MS, Lucida Sans Unicode, or any other Unicode compliant font of your choice. If the characters still don’t display correctly, Note that you still need the first step (changing the encoding).

A second, more permanent way around it is to change the font in the subtitle file. This can be done with SubResync, the small tool that’s installed with Vobsub. The nice thing about this tool is that it gives you a preview of the subtitles as they will be rendered. Open your .srt file in SubResync. You’ll see a list of the subtitles and their timing. Double-click the first line to bring up the ‘Subtitle Style Editor’. Here, you can select another font and even change the styling (outline, shadow) and placement of the text. Click ‘Save as…’ to save your changes. This will generate a .srt.style file (in our example, gunpowder.srt.style) which is used by Vobsub to read the settings. And presto! you’ve got your styled subtitles including special characters.3

Bonus tip: You only need to make these customizations once. If you like them, save a copy of the .srt.style file someplace you can easily find it. Whenever you need that style, you can just make another copy and change its name to that of the video clip you want to use it with (e.g. palmoil.srt.style instead of gunpowder.srt.style).

Questions?

Feel free to leave a comment if you have any questions. If you want to know how to embed subtitles in your actual video file (‘hardcoded subtitles’), here is an excellent tutorial by Robin Dittwald.

Footnotes

  1. If you have Internet Explorer 8 on your system, this unaccountably breaks SubResync. Here is a fix.
  2. I suppose it can even be fixed on the ELAN side by providing another encoding option.
  3. More advanced users may want to use SSA instead of SRT to format their subtitles. SubResync can easily save SRT as SSA and Vobsub plays with both. It seems you can do more advanced formatting with SSA.

Leave a Reply

Your email address will not be published. Required fields are marked *