YouTube · Translation

How to Translate YouTube Subtitles with an API

Sending a whole transcript to an LLM is slow enough to time out, and splitting it up carelessly loses lines. Here is what we measured, and the one parameter that does it for you.

The short answer

Add translate_to to a TranscriptAPI request. You get the subtitles of any YouTube video in the language you ask for, timestamps intact, in about 7 seconds for a 20-minute video.

German subtitles for any video
curl "https://api.transcriptapi.io/transcript?video_id=dQw4w9WgXcQ&translate_to=de" \
  -H "Authorization: Bearer $API_KEY"

Get a free key (20 credits, no card). No code needed? The free YouTube transcript translator does the same thing in the browser.

Why translating subtitles with an LLM is harder than it looks

The obvious approach is to send the whole transcript to a model in one call and ask for the same lines back in another language. It works, and it is slow. For a 19-minute video (286 caption segments) that single call took 35 seconds. The model has to write every line one after another, and many HTTP clients and serverless functions give up at 30.

Splitting the transcript into chunks and translating them in parallel fixes the speed. We measured 6.6 seconds for the same video with chunks of 40 segments, eight at a time. But it creates new problems:

35s → 6.6sfor a 19-minute video translated to German, from one sequential call to eight concurrent chunks, with the same model, prompt and output.
6 vs 1untranslated lines out of 286 with 25-segment chunks versus 40-segment chunks. The faster setting saved 0.8 seconds and lost five more lines, so we didn't ship it.
12.3sfor a 61-minute video. Chunks run in parallel, so an hour of subtitles takes about twice as long as twenty minutes, not three times as long.

What translate_to does for you

All of that tuning is behind one parameter: chunk size, concurrency, absolute line positions, and a fallback that keeps the original line when the model drops one, so the timeline never shifts.

translate.py
import os, requests

r = requests.get(
    "https://api.transcriptapi.io/transcript",
    params={"video_id": "dQw4w9WgXcQ", "translate_to": "es"},
    headers={"Authorization": f"Bearer {os.environ['TRANSCRIPTAPI_KEY']}"},
    timeout=60,
)
r.raise_for_status()
print(r.json())

What it costs

One credit for the transcript, plus one credit per 40 segments for the translation (at least 2), so 3 credits minimum. A 10-minute video is usually 5–7 credits. Failed requests are refunded. See pricing: the $49 plan has 25,000 credits a month, and one-time top-ups start at $10.

Start with 20 free credits, which is enough to translate a few videos and check the quality in your language.

Frequently asked questions

How do I translate YouTube subtitles automatically?

Request the transcript from TranscriptAPI with translate_to set to the target language code, for example translate_to=de. You get the translated segments back with the original timestamps, for any public video that has captions in any language.

Are the timestamps kept when the transcript is translated?

Yes. Every translated line keeps the start time of its source segment. If the model leaves a line out, the original line is kept in its place so the timeline never shifts.

How long does a translation take?

About 7 seconds for a 19-minute video in our measurements, and roughly 12 seconds for an hour-long one, because the transcript is translated in parallel chunks.

How much does translating a transcript cost?

One credit for the transcript plus one credit per 40 segments for the translation, with a minimum of 2 for the translation part, so 3 credits minimum. A 10-minute video is usually 5–7 credits.

Can I get translated SRT or VTT subtitle files?

Yes, through the MCP server (get_youtube_transcript with translate_to and format srt or vtt) and the free YouTube transcript translator. The REST endpoint returns JSON segments.