YouTube Transcript API for translators: timing kept

By the YouTubeTranscriptAPI engineering team · Published · Updated

On a 36-minute video with automatic captions, 93% of the caption lines stop in the middle of a sentence. Translate those lines one at a time and the German comes out in the wrong order, in fragments, with no verb where the viewer needs it.

To translate YouTube subtitles and keep the timing, fetch the caption track with timestamps, join the broken lines back into full sentences, translate each sentence with a length budget taken from the time it has on screen, then cut the translation back into cues inside that same time window. Check whether the video already has a track in your language first, since that costs nothing to translate.

The pipeline: fetch the timed caption track, rebuild sentences, translate with a character budget per sentence, then lay the text back into cues inside each sentence's time window and shorten any cue still too fast to read
Translate sentences, not caption lines.

We make YouTubeTranscriptAPI, so the caption step in this guide is ours. The sentence rebuild, the reading-speed limits and the cue layout work the same on any caption file with start times.

I read the subtitle rules in Netflix's timed text style guides for eight languages, YouTube's help pages on caption files and auto-dubbing, and five tools and guides that translate subtitles. Then I measured two real caption tracks and tested the free script below against both.

Everything here was checked on December 3, 2026.

How do translators get YouTube subtitles in another language?

Fetch the video's caption track with start times, translate it, and upload the result as a new language track in YouTube Studio. The catch is the middle step. Caption lines are cut for display, not for meaning, so a good translation has to work on whole sentences and then fit back into the original timing at a speed a viewer can read.

The transcript endpoint returns every caption line with its start time and duration, plus the title and the language of the track it found. You can ask for a language with the language parameter. If the video has that track, you get it. If not, you get another track, and the response tells you which.

That one response settles the first question every translator should ask: does a track in the target language already exist? Creators often upload their own Spanish or German captions. If one is there, you don't need a model at all.

Each fetch is 1 credit, and a video without any captions costs nothing; the error reference lists which responses are free. For one file by hand, our guide to YouTube transcripts as SRT and VTT gets you a subtitle file in a minute.

Why does translating caption lines one by one break subtitles?

Because a caption line is usually a slice of a sentence. On the automatic captions I measured, 93% of lines ended mid-sentence and 99.6% overlapped the next line on screen. Translated alone, each fragment loses the words that set its grammar, and languages with a different word order can't put the verb anywhere sensible.

The two tracks I used are a 36-minute science podcast with YouTube's automatic captions and a 90-minute interview with captions the creator uploaded. They're very different inputs.

The automatic track has 931 caption lines. Almost all of them are cut wherever the speech recognizer paused, and nearly every line is still on screen when the next one starts, because YouTube shows auto captions as a rolling two-line window. Rebuilt into sentences, those 931 lines become 372 sentences, and 91% of them end with a full stop, question mark or exclamation mark.

The creator track is tidier: 1,726 lines, none overlapping, but 27% still end mid-sentence. Someone cut them so they'd read well on screen, and that's a different job from translating.

Measured on two YouTube caption tracks: automatic captions have 931 lines, 93.0% ending mid-sentence and 99.6% overlapping the next, rebuilt into 372 sentences; creator captions have 1,726 lines, 27.1% mid-sentence and none overlapping
Caption lines are cut for the screen, not for grammar.

German puts the verb at the end of a subordinate clause. Japanese puts it at the end of almost everything. Split "I didn't think the results would hold up when we" from "ran it again," and no translator, human or model, can write a correct first half.

Tools that translate line by line with a large language model hit a second problem. The README of chatgpt-subtitle-translator, an open-source tool on GitHub, notes that models don't reliably keep one output line per input line, so the tool sends lines in batches and retries smaller batches when the count comes back wrong. Cerlancism's README explains the problem well. The script below does the same count check, on sentences instead of lines.

Why do translated subtitles come out too fast to read?

Because translations run longer than English while the time on screen stays the same. Netflix caps English subtitles at 20 characters per second for adults and German, Spanish, Italian, Dutch and Portuguese at 17. A sentence that fits in English often won't fit translated, so the subtitle flashes past before anyone finishes reading it.

The limits come from Netflix's timed text style guides, which are the most detailed public rules I found. Each language has its own page. The German guide sets 17 characters per second. Simplified Chinese allows 9 characters per second and 16 per line. The Japanese guide allows 4 characters per second and 13 full-width characters per line. Most languages get 42 characters per line and two lines at most.

Netflix's reading-speed FAQ says spaces and punctuation count, and half-width characters count as half in Chinese and Japanese. The script counts the same way.

Netflix reading-speed limits for adult translated subtitles: English 20 characters per second, German, Spanish, Italian, Dutch and Portuguese 17, Simplified Chinese 9, Japanese 4, with 42 characters per line or 16 and 13 for Chinese and Japanese
Most target languages read slower than English.

How much longer is a translation? The W3C's article on text size in translation cites IBM figures: English text over 70 characters grows to about 130% in European languages, and short strings grow more. I used 30% as a stand-in, not a measured translation.

On the automatic track, 77% of English sentences already fit 20 characters per second as spoken. Make them 30% longer and hold them to 17, and only 19% fit. The creator track went from 70% to 32%.

Most sentences need shortening as well as translating. On the automatic track, 84% of sentences came out over their limit, and about a fifth of all characters would have to go. Professional subtitlers condense all the time. The question is who does it and when.

How does the script keep timing and reading speed?

It gives the model a character budget for every sentence before it translates. The budget is the time until the next sentence starts, capped at 7 seconds a cue, times the reading-speed limit. Then the script cuts each translation into cues inside the sentence's own time window, merges or stretches cues that are too short, and asks the model to shorten any still too fast.

Spreading the translation over the source timing comes first. Inside each sentence, the script knows roughly when every word was spoken. For a caption line it shares the line's time across its words by length, which is an estimate, so it never moves text outside its own sentence.

Then the cue rules. Netflix sets a minimum of five-sixths of a second and a maximum of 7 seconds. Each cue gets at most two lines of 42 characters, broken at a word near the middle, or 16 and 13 for Chinese and Japanese. Cues never overlap, and there's a small gap before the next one.

Then reading speed. First the script stretches a fast cue into any silence after it. If it still reads too fast, the cue and its source sentence go back to the model, which is asked to say the same thing in fewer characters.

I tried it without the budgets first. Timing fixes alone left 88% of cues too fast on the automatic track and 76% on the creator track. No amount of stretching helps when the text is a third too long.

With budgets in the prompt and a model that follows them, the share still too fast fell to under 1% on the automatic track and 3.5% on the creator track. Every cue that stays too fast is listed in the report with its time and speed, so you can fix it by hand.

German cues still over 17 characters per second: 87.8% with timing fixes only and 0.8% with budgets on automatic captions; 76.1% and 3.5% on creator captions, with a stand-in translation 30% longer
Stretching cues alone leaves most of them too fast.

The script uses Claude Opus 5.5 with structured output, so each reply is a JSON list with one translation per sentence. If the count is wrong, the batch is split in half and sent again. Every batch also carries the three sentences before it, so pronouns and terms stay consistent.

What can YouTube already do without a translator?

Three things, none of which give you an editable subtitle file. Viewers can turn on auto-translate, but only for their own screen and only if the video has a caption track. Auto-dubbing makes spoken audio in other languages that you can't edit. And Studio can machine-translate a track, which still splits on caption lines.

Here's how the options compare:

OptionWhat you getCan you edit it?Timing
Viewer auto-translateCaptions translated on one viewer's screenNoSame lines as the source
YouTube auto-dubbingA dubbed audio trackNoFollows the speech
Upload your own fileA subtitle track every viewer seesYesWhatever your file says
Line-by-line machine translationA subtitle fileYesSource lines, often too fast
Sentence translation with budgetsA subtitle file plus a reportYesSource timing, checked for speed

YouTube's help page on automatic dubbing says plainly that you cannot edit automatic dubs, marks those videos as auto-dubbed, and calls lip sync experimental. If your client wants accurate German subtitles, a dub isn't a substitute.

Uploading your own file is the only route that puts a reviewed translation in front of everyone. That's the route this guide feeds.

How do you run translate_subtitles.py on a video or a playlist?

Install the Anthropic SDK, set two API keys, and pass the script a video link and one or more target languages. It fetches the captions, saves any existing track in that language, and otherwise translates by sentence and writes an SRT file, a VTT file and a JSON report per language. Start with --dry-run, which estimates the model cost without calling the model.

Download translate_subtitles.py. The commands:

bash
pip install anthropic
export YTT_API_KEY=tk_live_...
export ANTHROPIC_API_KEY=sk-ant-...
python translate_subtitles.py https://www.youtube.com/watch?v=VIDEO_ID --to de --dry-run
python translate_subtitles.py https://www.youtube.com/watch?v=VIDEO_ID --to de --to es --to ja
python translate_subtitles.py --playlist PL... --to pt-BR --out course-pt/

For each language, the script writes VIDEO_ID.de.srt, VIDEO_ID.de.vtt and VIDEO_ID.de.json into a folder named after the video. The report lists the source language, the number of caption lines and sentences, how many cues the model shortened, every cue still over the limit, and the model cost.

Some flags worth knowing. --force translates even when a track in the target language exists, which helps if the creator's track is poor. --cps 15 sets a stricter reading speed, for children's content or a client's house style. --model claude-sonnet-5-5 and --model claude-haiku-5-5 make cheaper runs.

A playlist listing costs 20 credits for up to 100 videos. A video without captions is skipped, costs nothing and the run goes on. If your key runs out of credits, the run stops and says so.

What does it cost to translate a YouTube video?

One credit per video and language for the caption fetch, plus the model. With Claude Opus 5.5, my estimate was about $0.30 for the 36-minute video and $0.71 for the 90-minute one, before thinking tokens. Sonnet 5.5 is roughly half that, and Haiku 5.5 is around 2 cents for 90 minutes.

Estimated model cost per language: $0.30, $0.15 and $0.008 for a 36-minute video on Opus, Sonnet and Haiku 5.5, and $0.71, $0.36 and $0.018 for 90 minutes, plus 1 credit per video and language
The review costs more than the API.

The model estimate counts the words in the source, the sentences of context sent with each batch, and a translation of similar length. Thinking tokens and the shortening pass come on top, so treat the numbers as a floor. The dry run prints the same estimate for your own videos.

The fetch costs the same for every language you add, because the script asks for each target language by name to check for an existing track. With --force, it fetches the source once.

New accounts get 100 free credits, enough for 100 video-language pairs. The pricing page has the monthly and annual plans, and founding prices hold if you subscribe within 7 days of signing up.

For a translator quoting a job, the transcript and model cost are small next to the review. Most of your time goes on reading the file against the video.

How do you upload translated subtitles to YouTube?

In YouTube Studio, open the video, go to Subtitles, add the language, choose to upload a file, and pick "With timing." Then select the SRT or VTT file from the script. YouTube reads the cue times from the file, so the translation appears exactly where the script placed it.

YouTube's page on supported subtitle files accepts SRT and SBV in their basic form, as plain UTF-8 without styling, and also takes WebVTT. Google recommends SRT or SBV for most people. The script's SRT has no styling, and both files are written as UTF-8, so accents and Japanese characters survive the upload.

If you're translating for a client who owns the channel, send them the SRT and the report. They can upload it themselves, and the report shows them every cue you checked.

If the job is a download, not an upload, our guide to downloading YouTube subtitles covers saving existing tracks in every language a video has.

What did we test, and what didn't we?

I tested the script with fake translators on the real timing of two caption tracks, not with live Claude calls. The fakes make each sentence 30% longer, or follow the budget, or return the wrong count. So the cue layout, timing and reading-speed numbers are real measurements of the code. Translation quality isn't measured here at all.

Seventeen tests cover the parts that can break. Every word survives the sentence rebuild. Cues stay inside their sentence, never overlap, last between 0.3 and 7 seconds, and keep two lines of 42 characters at most. The SRT and VTT files parse in standard libraries. An existing target track is saved with no model call.

Two caveats matter for the numbers in this guide. The 30% growth is the IBM average, and real text varies by language and subject. The under-1% figure assumes the model keeps to every budget, which a real model will only mostly do. The shortening pass is there for the rest.

Word times inside a caption line are estimates, so a cue can start a fraction of a second early or late within its sentence. On fast speech I'd check the first few minutes against the video.

Frequently asked questions

Can I translate YouTube subtitles without downloading the video?

Yes. A transcript API returns the video's caption text with start times from its link, so there's no video or audio to download. You translate that text and upload the result as a subtitle file. It only works when the video has captions, either uploaded by the creator or generated automatically by YouTube, which most spoken videos in common languages have.

Does YouTube auto-translate count as a translated subtitle track?

No. Auto-translate runs on the viewer's screen, needs an existing caption track, and translates each caption line as it appears. Nothing is saved to the video, other viewers don't see your choice, and you can't edit the result. To give every viewer a reviewed translation, upload a subtitle file in that language through YouTube Studio.

What reading speed should translated subtitles use?

Netflix's guides are a good default: 20 characters per second for English and 17 for German, Spanish, Italian, Dutch and Portuguese. Simplified Chinese allows 9 and Japanese 4, counted in full-width characters. Children's programming uses lower limits, so set a stricter speed when the audience reads slowly or the client has its own style guide.

Why are my translated subtitles out of sync?

Usually because each caption line was translated alone and the text no longer matches the speech. Word order changes across languages, so a fragment's translation can describe what's said a second later. Automatic captions also overlap on screen. Rebuilding full sentences first and keeping each translation inside its sentence's time window fixes both problems.

Which file format should I upload to YouTube?

SRT is the safest choice. YouTube accepts SRT and SBV in their basic form, as plain UTF-8 without styling, and also takes WebVTT. When uploading in Studio, choose the option with timing so YouTube reads your cue times rather than guessing them. Keep the file in UTF-8 so accented letters and Asian scripts display correctly.

Can I translate a whole YouTube playlist at once?

Yes. Pass the playlist ID and the script lists up to 100 videos for 20 credits, then translates each one into every language you name. Videos without captions are skipped and cost nothing. Run one video first and read its report before starting a playlist, since a mistake in the settings would repeat across every file.

Translate one video before you translate a course

Dry-run one video to see the cost, translate it into one language, and play the file against the video before anything else. Read every cue the report flags as too fast. If the timing and the cuts look right, run the playlist and spend your hours on the terms and names a model gets wrong.

The same caption fetch drives our podcast show notes guide, if you also need notes and chapters for each episode. Get your transcript key from the sign-up page.


About the author: the YouTubeTranscriptAPI engineering team builds and runs the hosted YouTube Transcript API and its MCP server. We test every script we publish against mocks, real transcripts or the live product, and say which.