I'm Dudley Storey, the author of Pro CSS3 Animation. This is my blog, where I talk about web design and development with HTML, CSS and SVG. To receive more information, including news, updates, and tips, you should follow me on Twitter or add me on Google+.

my books

Pro CSS3 Animation, Apress, 2013

Using SVG with CSS3 and HTML5, O'Reilly, 2017

my other blogs

Massive Head Canon: Intelligent discussion of movies, books, games, and technology.

my projects

The New Defaults — A Sass color keyword system for designers. Replaces CSS defaults with improved hues and more memorable, relevant color names.

CSSslidy — an auto-generated #RWD image slider. 3.8K of JS, no JQuery.

Creating And Validating WebVTT Subtitles

Easy ways of making video subtitles with web standards.

As a newly-emerging format, the tools to create WebVTT text tracks for HTML5 audio and video are limited. Right now, the most straightforward method is Microsoft’s Video Caption Maker: as an online tool, it’s available to every platform (instructions). However, it has very limited features; for complete, millisecond-level control of subtitles, I’d recommend a native application.

Subtitling Applications

While no subtitling programs natively support WebVTT yet, it’s very easy to convert the .srt files they produce into .vtt files. (See instructions in the next section).

  • Subs Factory is a free, full-featured subtitle editor for Mac OS X; it has a few interface issues, and is a translation from French, but is still very good.

  • Jubler is cross-platform, based on Java, and as such it’s somewhat slower.

  • Subtitle Edit is very fully-featured, but Windows-only.

All of these applications export subtitles in .srt format; the next step is to convert the file into .vtt format.

Converting SRT to VTT

Due to their close relationship, conversion from .srt into .vtt is very simple. A typical .srt file will look something like this:

  1. 1
  2. 00:01:21,700 --> 00:01:24,675
  3. Life on the road is something
  4. I was raised to embrace.

The process is little more than a find-and-replace:

  • Start the text file with WEBVTT

  • Remove the cue markers at the start of each subtitle, or replace them with Cue - prefixes.

  • Optionally, remove the 00: hour marker at the start of each timestamp.

  • Convert the comma before the millisecond mark in every timestamp to a decimal point (easy enough with a find-replace: ,7 to .7, for example).

  • Optionally, add styling markup to the subtitle text.

  • Save the file with a .vtt extension and link to it from a <track> element in an HTML5 page.

The resulting file looks like this:

  1. WEBVTT
  2. 01:21,700 --> 01:24,675
  3. Life on the road is something
  4. I was <i>raised</i> to embrace.

Alternatively you could use an online resource, such as Simple SubRip (GitHub source).

Validating A VTT File

The W3C doesn’t yet offer a validation service for .vtt files, but others exist: right now, I’d recommend this Live WebVTT validator created by Anne van Kesteren.

This site helps millions of visitors while remaining ad-free. For less than the price of a cup of coffee, you can help pay for bandwidth and server costs while encouraging further articles.