How to Translate a VTT File Without Losing Cue Settings
What to translate in a WebVTT file, what our test of BookTranslator's VTT output kept and dropped, and a free script that puts cue settings back.

To translate a VTT file, translate only the words people read on screen. Everything else stays as it is: the WEBVTT line, STYLE, REGION and NOTE blocks, cue identifiers, the timing line and any settings after it, and the tags inside the text. Then compare the translated file with the original before you publish it, because a VTT file can lose its cue settings without looking broken.
Losing settings is common. We ran BookTranslator's own subtitle code on a six-cue test file. Timings, cue identifiers and inline tags came through. Cue settings, STYLE and REGION blocks, comments and the header title did not. A caption placed at the top of the video, out of the way of on-screen text, goes back to the default position, normally the bottom. Below we explain what each part of the file does, what we found, and how to put the settings back with a free script.
What to Translate in a VTT File
The W3C WebVTT specification defines the parts of the file. This table sorts them by what a translator should do.
| Part of the file | Example | Translate? | Why |
|---|---|---|---|
| Header line | WEBVTT - Lecture 3: Bread chemistry | Keep as is | WEBVTT must come first. Text after it on the same line is not shown to viewers. |
NOTE blocks | NOTE Captions by the course team. | Optional | Comments for people working on the file. Viewers never see them. |
STYLE block | ::cue(.term) { color: yellow; } | No | CSS. Class names here must match the <c.term> tags in the cues. |
REGION block | id:top width:60% | No | Defines an area of the video that cues can be placed in. |
| Cue identifier | intro | No | Can be the target of a ::cue(#intro) style, and scripts may look cues up by it. |
| Timing line and cue settings | 00:00:01.000 --> 00:00:04.000 align:start position:10% | No | Times and placement. |
| Cue text | Welcome back. Today: yeast & salt. | Yes | What viewers read. |
| Voice tag | <v Professor Lee> | No, keep the name | The name can be the target of a style such as ::cue(v[voice="Esme"]), an example taken from the spec. |
| Class, italic, bold, underline, language tags | <c.term>autolyse</c> | Translate only the words inside | The tag marks which words get the style. |
| Ruby | <ruby>捏ねる<rt>koneru</rt></ruby> | Decide per case | Shows a reading next to the base text. Keep it if your readers still need the original word. |
| Timestamp tags | Mix, <00:00:17.500>rest | Keep, then check where they land | Each one marks the moment that point in the cue becomes current, which players can use to highlight words in turn. Translation can change word order, so a tag can end up before the wrong word. |
Two text rules come from the specification. Cue text cannot contain a bare & or <; they are written & and <. Cue text also cannot contain -->, because that string marks a timing line.
What Our Test Kept and Dropped
We wrote a six-cue English test file with every structure in the table above. On 2026-11-17 we ran it through the parse and write steps of BookTranslator's subtitle code locally. We did not call a translation model. We wrote the Spanish by hand and kept every tag, then passed it to the write step instead of model output. So this test shows what happens to the structure of the file, not how good a translation is or whether a model keeps every tag. The Spanish output and the README are public.
| In the source | After translation |
|---|---|
WEBVTT - Lecture 3: Bread chemistry | WEBVTT only |
2 NOTE blocks | Removed |
1 STYLE block | Removed. The <c.term> tag stayed, but nothing now makes it yellow. |
1 REGION block | Removed |
Cue identifier intro | Kept |
| Timings for all 6 cues | Kept, to the millisecond |
align:start position:10% on cue 1 | Removed |
line:0 region:top on cue 2 | Removed. This cue sat on the top line, clear of text shown in the video. |
size:80% on cue 4 | Removed |
<v>, <c.term>, ruby and timestamp tags | Kept, because our Spanish kept them |
& and < written bare in the Spanish | Written as & and < |
The music-only cue ♪ ♪ | Not sent for translation and kept as is |
We also parsed all three files with media-captions 0.0.18, the parser BookTranslator's code uses. All three parsed without errors. The source has one region and placement on three cues; the translated file has none. We did not test how individual players display the files.
The cause is in how the file is written back. The parser reads cue settings, but the writer rebuilds each cue from its identifier, start and end times and text, so anything outside those parts is lost. One addition goes the other way: for a right-to-left target such as Arabic, the code adds its own STYLE block that sets direction: rtl. Our product page currently says supported VTT cue settings stay with their cues. In this test they did not.
How much this matters depends on your file. Open it in a text editor and look for text after the end time on timing lines, and for lines that read STYLE or REGION. If there are none, nothing visible was lost. If there are, the translated file will look different until you put them back.
Put the Settings Back With a Script
We wrote vtt_carry_settings.py to compare a translated VTT with its source and copy back what was dropped. It needs Python 3.8 or later and nothing else.
First, check the translated file:
python3 vtt_carry_settings.py check lecture-en.vtt lecture-es-after-translation.vtt
On our files it printed:
header text: source 'WEBVTT - Lecture 3: Bread chemistry', translated 'WEBVTT'
STYLE blocks: source 1, translated 0
REGION blocks: source 1, translated 0
NOTE blocks: source 2, translated 0 (comments; optional)
cue 1 (intro): settings 'align:start position:10%' became '(none)'
cue 2: settings 'line:0 region:top' became '(none)'
cue 4: settings 'size:80%' became '(none)'
7 problem(s) in 6 cues
The check also reports changed cue counts, timings or identifiers, voice or class tags that went missing, a bare & or <, a --> in the text, and empty cues. When we deleted one <v Student> tag from a copy of the file, it reported cue 3: tags [...] became [...] with the missing tag.
Then restore what was dropped:
python3 vtt_carry_settings.py restore lecture-en.vtt lecture-es-after-translation.vtt lecture-es-restored.vtt --keep-notes
The script keeps the translated text and the translated timings, and copies the header line, the STYLE and REGION blocks and each cue's settings from the source. --keep-notes also copies the comments. Leave it off if your notes are for the source-language team only. Running check on the restored file printed 0 problem(s) in 6 cues.
The script matches cues by order, so it refuses to run if the two files have a different number of cues or different timings. That is deliberate. If a tool merged, split or retimed cues, copying settings by position would put them on the wrong lines, and you should place those cues by hand. If the translated file already has a STYLE block, such as the right-to-left block mentioned above, the script keeps it and adds the source block after it.
Check Tags and Line Length
A clean structure check does not mean the captions read well. Before you publish, look at these three things.
Timestamp tags after reordering. In our cue 5, Mix, <00:00:17.500>rest, <00:00:18.500>then fold. kept its order in Spanish. In a language that puts the verbs in a different order, the same tags would mark the wrong words. Move the tags to the matching words, or delete them and show the whole cue at once. The specification requires each timestamp tag to fall after the cue's start time and before its end time.
Voice names and class names. Translators sometimes translate a speaker name such as <v Professor Lee>. If a STYLE block colors that voice, the style stops matching. Keep the name in the tag and, if viewers need a translated label, put it in the cue text instead. Class names such as .term must stay exactly as written for the same reason.
Length. Translations often run longer than the source, and VTT gives a cue no more time because its text is longer. Our bilingual subtitle guide uses Netflix's published line-length and reading-speed limits and includes a checker for them. If accented characters come out as symbols, the file's encoding is the problem, which our subtitle encoding guide covers.
Translate the VTT, or Convert to SRT First?
Translate the VTT if the place you are publishing accepts it. Web pages load captions through the HTML <track> element in this format, YouTube accepts it, and converting to SRT throws away the settings, styles and regions you are trying to keep. Convert to SRT only when the destination accepts nothing else. If your source is an ASS or SSA file with typeset signs, it follows different rules; see our ASS subtitle guide.
Translate a VTT File With BookTranslator
BookTranslator's subtitle translator accepts VTT files. It sends each cue's text for translation with the timing kept separate, and it gives you two files: the translated VTT and a bilingual VTT with the original line above the translation under the same timestamp. You see the price before you pay. Our AI subtitle translation guide covers what to review in the translation itself.
If your source file has cue settings, STYLE or REGION blocks, run vtt_carry_settings.py restore on the translated file afterwards, as shown above, until the product keeps them on its own. If your file has none of these, the translated file is ready for your checks as it is.
Related Posts





