How to use it
- Choose an .srt file, drop it on the box, or paste the subtitles; the result appears at once.
- Read the notes next to the result: they list what was changed or left out, with line numbers.
- Download the .vtt file or copy the text.
Rules and limits
How the conversion works
- Times:
00:01:02,500becomes00:01:02.500. One or two digits after the comma are tenths and hundredths (,5is 500 ms); times without hours or with a dot are read too. - Cue numbers stay, as cue identifiers. Text after a blank line inside a cue stays with that cue, and a cue that follows without a blank line is found too.
<i>,<b>and<u>stay;<font>and other tags and codes such as{\an8}are removed.&,<and>in the text are escaped, so a-->in a line cannot end the cue.- Position coordinates after the times (
X1:… Y2:…) are left out. The cues are put in order of their start times, as WebVTT requires. - A byte order mark and Windows or old Mac line breaks are read. A file that is not UTF-8 is read as Windows-1251 or Windows-1252. The WebVTT file is UTF-8 with Unix line breaks.
Limits
- Tested in Chrome on a laptop: a file of 1 MB with 20,000 cues (about 11 hours of subtitles) in about 1 second, both ways.
- An error names its line: a time line that cannot be read, or minutes or seconds over 59.
Questions and answers
What is the difference between SRT and VTT?
Both list cues with a start time, an end time and text. WebVTT starts with the line “WEBVTT”, puts a dot before the milliseconds and can also hold styles, positions and notes. Browsers play only WebVTT in an HTML5 video.
My subtitles show strange letters. Why?
Old SRT files are often saved in a Windows code page instead of UTF-8. The page then reads them as Windows-1251 (Cyrillic) or Windows-1252 (Western European) and says so in the notes. The new file is always UTF-8.
How do I add the subtitles to a video on my website?
Put the .vtt file next to the video and add <track kind="subtitles" src="film.vtt" srclang="en" label="English"> inside the <video> element. Colours can be set with the CSS selector ::cue.