Skip to content
EN
Get API key
Browse documentation

Guides

YouTube transcripts and captions: from one video to a training dataset

Open the video description and choose Show transcript. If captions are available, you can read the words and jump to the moment they were spoken. No API or download is needed.

On this page

How to get a YouTube transcript without downloading the video

  1. Find the passage. On the watch page, expand the description and select Show transcript. Select a line to play that moment.
  2. Check the language. The player's Subtitles/CC menu controls the text. Audio track, when present, controls what you hear. Switching the audio does not guarantee that the transcript changes with it.
  3. Verify a quote. Copy the passage where text selection is available, or note the words and timestamp. Replay the line to check names, numbers, and words like “not” that can reverse the meaning.
Sources

Save captions for a video you manage

In YouTube Studio → Subtitles, choose the video and select Edit beside the language you want. Under Options, choose Download subtitles. Keep the timed file; you can export a plain-text copy later.

If there is no track yet and you have a script in the spoken language, Studio can synchronize the script to the audio.

Sources

When there is no caption track

Retrieving captions reads existing text. Transcribing creates new text from audio. For a recording you own or have permission to process, use a speech-to-text tool in transcribe mode to keep the spoken language. Translation is a separate step. Without captions or authorized access to the audio, ask the publisher for a transcript.

For example, to transcribe your own English interview locally, first select the correct audio stream. With FFmpeg, whisper-cli from the whisper.cpp quick start, and its English base.en model installed, the following produces both interview.txt and interview.srt:

Transcribe a local recording with whisper.cpp
ffmpeg -i interview.mp4 -map 0:a:0 -ac 1 -ar 16000 -c:a pcm_s16le interview.wav
whisper-cli -m models/ggml-base.en.bin -f interview.wav -l en -otxt -osrt -of interview

Here 0:a:0 selects the first audio stream, not necessarily the original language. Listen to it first. For Japanese speech, for example, select the Japanese stream, use the multilingual model ggml-base.bin, and set -l ja. Review the output against the recording. This text was created by your transcription process; it is not a caption track supplied by YouTube.

Source

What captions, subtitles, and transcripts are

A caption track is a sequence of cues: a piece of text and the time it should appear. Closed captions can be switched on and off. Accessibility captions convey meaningful sound as well as speech: a speaker change, a knock at the door, or an alarm that someone reacts to. Subtitles often means translated dialogue, but in many countries it also means same-language captions. The menu label alone does not tell you who wrote the words or whether they are a translation.

A transcript presents the words for reading, with or without timestamps. YouTube's transcript panel is a reading view of captions, not an independent second transcription. A summary is different again: it can leave things out or paraphrase. If a speaker says "put it here" while pointing at a diagram, the transcript may say exactly that without explaining where. A descriptive transcript adds the missing visual information.

Sources

The three types of YouTube captions

When comparing transcripts, classify the caption track you actually received. The three common sources are creator-provided captions, YouTube's automatic transcription, and YouTube's automatic translation. The last two both use automation, but only one listens to the speech.

Caption sourceHow the text was madeExample: a Japanese interview
Creator-provided (uploader)The channel supplies or publishes the wording. It can be typed, uploaded, or edited from an automatic draft. It is not necessarily written from scratch or verbatim.The creator publishes English subtitles reading "Please wait a moment." This is a translation, but its source is still the creator, not YouTube Auto-translate.
YouTube auto-generated (speech recognition, or ASR)YouTube turns speech into text in the same language. It can mishear the speaker; no translation is involved.The guest says chotto matte. The track represents those words in Japanese.
YouTube auto-translated (machine translation)YouTube turns existing caption text into another language. The source can be uploader-provided or automatic. It does not listen to a dub in the target language.YouTube renders the Japanese caption in English as "Wait a little." If the Japanese caption misheard a name, the translation can inherit that error.
Sources

Why one video can have several English texts

A dub is audio, not a fourth caption type. In the same fictional interview, the English voice actor might say "Give me a second." Both English subtitles above convey the meaning. Neither contains those spoken words. Use either for understanding, listen to the dub for a direct quote, and keep the source text and translation method separately for a translation dataset.

The original audio is the source performance; default playback is what the player selects and can differ with viewer preferences. Changing the caption language does not switch the audio. Do not assume every dub has a matching ASR track: YouTube describes automatic captions for multi-audio videos as being in the default language, not one transcription per dub.

Sources

YouTube transcript formats: TXT, SRT, VTT, and JSON

FormatChoose it forWhat to keep in mind
Plain text (TXT)Reading, notes, or a summaryEasy to edit, but flattening the track discards the link from each line to the video unless you preserve it separately.
SubRip (SRT)Moving timed subtitles between editors and playersNumbered cues with start and end times. Useful when you care about playback rather than rich styling.
WebVTT (VTT)Captions for a web playerRetains cue timing and can carry extra information such as positioning or voice labels when the author supplied them.
JSON or JSON Lines (JSONL)Searching across videos or building datasetsYou choose the schema. State whether times are seconds or milliseconds and whether they refer to the full video or an exported clip.

Here is the fictional uploader subtitle in WebVTT. Its 1.9 seconds describe when to display the cue, not the start and end of each word.

A timed WebVTT cue
WEBVTT

00:01:04.200 --> 00:01:06.100
Please wait a moment.

A text-only copy can simply say "Please wait a moment." A searchable note is more useful as "01:04 · Please wait a moment." If you cut a clip starting at 01:00, the subtitle belongs at 4.2 to 6.1 seconds in that clip, not 64.2 to 66.1. Keep the original time range so you can reconstruct the reference.

Sources

How to build a YouTube transcript dataset

Decide what one example is supposed to prove before collecting thousands of tracks. The same cue can be usable for one dataset and wrong for another:

Dataset goalUseful evidenceWhat to reject or label separately
Search, summaries, or question answeringA readable passage, its language, a video ID, and a time range to citeDo not present a translated passage as a verbatim quote from the speaker. Keep summaries separate from source text.
Speech recognition or word alignmentA specific audio clip paired with the words actually audible in itReject wrong dubs and paraphrases as verbatim labels. Separate unreviewed ASR from human-checked references.
Speech or text translationIdentified source speech/text and its corresponding translationKeep human and machine translations distinguishable where known. Cues across languages can split or merge; line 12 need not translate line 12.
Video-text or multimodal trainingText that describes what appears in the relevant framesNarration can refer to something off camera or to the next step. For example, HowTo100M used instructional narration as a training signal, not hand-verified descriptions of every frame.
Source

Record the audio and caption pair

A video ID is not enough: it does not say which audio you used, which caption version you retrieved, or why a reviewer accepted a pair. Here is one illustrative dataset record, not a YouTube or FlashData API response:

Dataset manifest: one caption and its audio
{
  "video_id": "EXAMPLE0001",
  "audio_asset": "interview-en-dub.wav",
  "audio_language": "en",
  "caption_language": "en",
  "caption_origin": "uploader",
  "start_s": 64.2,
  "end_s": 66.1,
  "time_base": "source_video",
  "text": "Please wait a moment.",
  "review": "English dub says 'Give me a second.'",
  "use_for_search": true,
  "use_as_verbatim_speech_label": false
}

That last decision is the point: both languages are English and the cue is on time, yet the text is not a verbatim label. For a real collection, also record the source or track identifier where available, retrieval date, file/version identifier, and the permission or license covering the intended use. Leave unknown provenance unknown rather than inferring it from a filename.

Check the collection before using it

  1. Measure coverage. Count attempted videos, videos with a track in the target language, and videos that pass your quality policy. Separate "no eligible captions" from "could not retrieve." Otherwise a temporary failure looks like a language with poor coverage.
  2. Listen and sample. Review clips across languages, caption sources, and channels. Check that numbers, names, negations, speaker changes, and cue boundaries match the actual recording. For verbatim speech, compare a sample to independently transcribed reference text. Word error rate counts substitutions, deletions, and insertions per reference word; it is not a translation-quality or timing score.
  3. Preserve the source and the time base. Keep the timed track alongside cleaned text when permitted. Normalize line breaks for search, but don't blindly drop repeated phrases: "no, no" may be genuine speech. Check cues against clip duration and account for any trim offset.
  4. Split by recording, not by caption line. Keep clips, dubs, and translations of the same recording in the same train/test split. Otherwise a model can see the same interview during training and evaluation. Keep unverified pairs out of an evaluation set intended to measure verbatim accuracy.
  5. Check rights before collection or release. Publicly viewable does not mean cleared for redistribution or training. Record what permits your intended use, check for personal information, and plan for corrections or removals. Keep this decision separate from technical quality.
Sources

Retrieve existing tracks with FlashData

Use this path when you have video IDs and want existing captions as text and timed segments. It does not generate speech-to-text for an uncaptioned video. YouTube Transcript and YouTube Captions use the same track-selection rules. Their defaults differ: youtube_transcript allows automatic sources (auto: true); youtube_captions defaults to uploader-only (auto: false). Both target English when language is omitted.

Here is a single-video Python example using requests. Replace the placeholder key and use a video ID you are authorized to process. Availability depends on the video:

Retrieve an existing transcript with Python
import requests

response = requests.post(
    "https://data.flashdata.dev/v1/queries/realtime",
    headers={"X-API-Key": "your-api-key"},
    json={
        "source": "youtube_transcript",
        "video_id": "jNQXAC9IVRw",
        "params": {"language": "en", "auto": True},
    },
    timeout=(5, 90),
)
response.raise_for_status()
track = response.json()["results"][0]
print(track["languageCode"], track["captionSource"])
print(track["fullText"])
for cue in track["segments"]:
    print(f"{cue['start']:.3f} to {cue['end']:.3f} s: {cue['text']}")

Choose a language and caption source

A language code such as "en" asks for English regardless of the audio. To follow an audio track instead, use "original" for the marked original language or "default" for the playback language marked for the worker, not your browser setting. FlashData resolves both from audio information in the same extraction.

An explicit track code works differently: "en-orig" with auto: true requests that exact automatic track, without fallback. The -orig suffix is a yt-dlp naming convention, not proof that English was the original audio.

For an ordinary language code, "default", or "original", auto: true tries caption sources in this order, all in the target language:

  1. Native speech recognition (youtube_asr): YouTube transcribed the speech.
  2. Uploader captions (uploader): the channel supplied the text.
  3. Unclassified automatic captions (youtube_auto_unknown): the evidence does not distinguish ASR from translation. This is uncertainty about the source, not a fourth way of making captions.
  4. YouTube machine translation (youtube_translated): YouTube translated another caption track.

With auto: false, only uploader captions qualify. In the interview example, suppose playback is marked English. There is an English upload and a YouTube translation, but no English ASR. Asking for "default" with auto: true returns captionSource: "uploader" and isAutoGenerated: false.

Source

Request more than one language

Send an array such as ["original", "en", "es"] for the same video. This requests each of 1 to 10 distinct selectors with one auto policy, not the first available language. Even a one-item array returns results[0].tracks and results[0].errors instead of a single track.

Successful tracks stay in request order. Match a track by requestedLanguageCode when present, otherwise by languageCode. Errors identify the failed selector by languageCode. Keep successes when another language fails. If none succeeds, handle the request-level error.

Tell a missing track from a failed fetch

An unconfirmed original language (youtube_original_language_unknown) differs from a known original language with no eligible captions (youtube_original_subtitles_unavailable). For default playback, the corresponding errors are youtube_default_language_unknown and youtube_default_subtitles_unavailable.

If YouTube returns HTTP 429 when serving translated captions and no requested track succeeds, FlashData's realtime API can report HTTP 502 with youtube_subtitle_retrieval_failed. With partial success, the failed selector can instead have errors[].code: "retrieval_failed". A bare 502 does not diagnose a YouTube 429. A 429 from FlashData's own request limiter is separate from a 429 at YouTube.

The YouTube Download API selects audio separately via audio_language and may fall back to another track; asking both APIs for "original" does not establish alignment. See the timestamped captions recipe for saving results and the Bulk file guide for processing a list of video IDs.

YouTube transcript FAQ

Can I get a YouTube transcript for free without downloading the video?

Yes, when captions are available, YouTube's Show transcript feature lets you read the text on the watch page without buying a tool or downloading media. For one lecture or interview, start there.

Source

Why is there no transcript when I can see subtitles in the picture?

Turn closed captions off. If the words remain, they may be burned in: part of the image rather than a selectable text track. A video can also lack published captions, or automatic captions may still be processing. For authorized material, transcribe the audio if you want what was said, or use optical character recognition (OCR) with review if you need the exact words printed on screen. The two can differ.

Can I get English text if the audio is in another language?

Often, but not always. Look for English subtitles first; if none are listed, check whether the player offers Auto-translate. This translates available captions. It does not create English audio or establish that the English dub used the same words.

Source

Does "auto-generated" mean "machine-translated"?

No. Speech recognition turns speech into writing in the same language. Machine translation changes text from one language to another. Both processes can be automatic, and a translation may start from imperfect speech recognition. When the origin is not disclosed, label it unknown.

Why does yt-dlp report HTTP 429 for YouTube auto-translated captions?

A video can list a translation even when YouTube declines the request for its text with HTTP 429 (Too Many Requests). In yt-dlp issue #13831, the maintainer's pinned explanation identifies YouTube's auto-translated captions as the affected case. Uploader-provided tracks and original-language ASR were not affected by that particular issue. It does not mean all translations fail or that other caption requests can never be rate-limited.

If you just need readable text, check for an existing uploader or native ASR track in your target language. If you specifically need the YouTube translation, preserve successful tracks and defer only the failed translation. Honor Retry-After when the response includes it; otherwise back off, limit retries, and avoid retrying an entire collection at once. Record the outcome as retrieval failed, not no captions. A Japanese track arriving successfully does not satisfy a request for English.

Sources

How do I get just the text without timestamps?

Export a plain-text version of a caption file, or join its cue text in order. Keep the timed original if you might later cite a line, make clips, or correct an error. Removing timestamps is easy; recovering accurate timing from a paragraph is a separate alignment task.

Are transcripts available for YouTube Shorts and livestreams?

YouTube supports automatic captions for eligible Shorts as well as long-form videos, but availability is not guaranteed. Live captions and the archived video's captions are not necessarily the same: YouTube says it generates new automatic captions for the on-demand version. For a reproducible dataset, record which version you used and when.

Source

Does the official YouTube Data API return transcripts for any public video?

No. Google's OAuth-authorized captions.list returns track metadata, not the actual words. captions.download retrieves the track and requires permission to edit the video. Being able to read a transcript as a viewer is not the same as having that API permission.

Sources

Are speaker names and word-by-word timestamps included?

Not reliably. A cue may cover a whole phrase, and a track may label a speaker, mark a sound, or do neither. If you need to know who spoke when, annotate or run speaker diarization and verify it. If you need when each word was spoken, use word alignment against the actual recording; don't divide a cue's duration evenly among its words.

Are YouTube transcripts accurate enough to quote?

Use the transcript to find the moment; use the recording to check the quote. If a Japanese speaker is quoted in English, say whether the words are your translation, the uploader's subtitle, or the dub. A fluent sentence is not evidence that any particular speaker used those exact words.

Can public YouTube transcripts be used to train a model or shared as a dataset?

Public access alone does not grant permission for either use. Establish what covers collection, training, and any redistribution of the text or media; those are separate decisions. Then decide whether the labels fit the task: a permitted English translation can still be the wrong reference for English speech recognition. YouTube's license guide explains the difference between its standard license and Creative Commons Attribution.

Source

Why is a transcript different when I fetch it again?

Check the video, audio language, caption language, and track source. You may be comparing two tracks. Even the same video can change: a creator can edit text or timings and publish a revised caption track. Keep a retrieval date and version or content hash when permitted so you can distinguish an edit from a change in your selection policy.

Source
Markdown