Home → Blog → How to transcribe a YouTube video to text
How to transcribe a YouTube video to text
There are three ways to turn a YouTube video into text, and they differ enormously in quality and in what you are allowed to do with them. Picking the wrong one is how people end up with a wall of unpunctuated words and no timestamps.
Option 1: the captions YouTube already made
Every popular video already has auto-generated captions. Open the transcript panel under the video, copy the text, done — no code, no cost.
Where this falls apart:
- Quality varies wildly. Auto-captions are generated once, at upload, by a model tuned for breadth rather than accuracy. Technical terms, names and numbers suffer.
- No punctuation in many languages. You get a stream of words, which is fine for search and useless for reading.
- It does not scale. Copying by hand works for one video, not for a channel archive.
- They may not exist at all for smaller channels or less common languages.
For a single video you want to read once, stop here — it is free and takes ten seconds. For anything repeatable, keep going.
Option 2: your own transcription of the audio
This is what you want when the text matters: for your own videos, for research, for content you are going to publish. Extract the audio, send it for recognition, get punctuated text with timestamps.
Extracting the audio from a file you already have:
ffmpeg -i video.mp4 -vn -ac 1 -ar 16000 -b:a 48k audio.mp3
Then a single request:
from openai import OpenAI
client = OpenAI(base_url="https://voicesscribe.com/v1", api_key="your key")
with open("audio.mp3", "rb") as f:
r = client.audio.transcriptions.create(
model="whisper-1", file=f, response_format="verbose_json",
)
print(r.text)
The difference from auto-captions is immediate: punctuation, correct casing, and segments with exact timings you can turn into chapters or subtitles.
A note on downloading other people's videos
Downloading video from YouTube is restricted by its Terms of Service, and the content itself is usually someone's copyrighted work. Transcribing your own uploads, or material you have rights to, is straightforward. For everything else, the honest options are the built-in transcript panel or asking the author.
This is not legal advice and the rules differ by country — but "the tool made it easy" has never been a defence, and it is worth knowing which side of the line you are on before building a pipeline.
Option 3: bulk work over a channel archive
For your own back catalogue, the job is the batch pattern: a folder of files, a work queue, and results derived from what already exists on disk.
import pathlib
from openai import OpenAI
client = OpenAI(base_url="https://voicesscribe.com/v1", api_key="your key")
OUT = pathlib.Path("transcripts"); OUT.mkdir(exist_ok=True)
for video in pathlib.Path("videos").glob("*.mp4"):
out = OUT / (video.stem + ".txt")
if out.exists():
continue # already done — do not pay twice
audio = video.with_suffix(".mp3")
# ffmpeg -i video.mp4 -vn -ac 1 -ar 16000 -b:a 48k audio.mp3
with audio.open("rb") as f:
out.write_text(client.audio.transcriptions.create(
model="whisper-1", file=f).text, encoding="utf-8")
An hour of video becomes about 25 MB of mono audio, which fits a single request. Longer recordings get split — the size limit is 25 MB per request.
Getting subtitles instead of plain text
If the goal is to put captions back on the video rather than to read the text, ask for the subtitle format directly and skip the conversion step:
srt = client.audio.transcriptions.create(
model="whisper-1", file=f, response_format="srt",
)
open("video.srt", "w", encoding="utf-8").write(srt)
The resulting SRT uploads to YouTube in the subtitles section of the video and replaces the auto-generated track. For most channels this alone is a visible quality jump, because your captions now have punctuation and the right spelling of names.
Making the text worth publishing
- Feed in the vocabulary. Channel name, guest names, product names and recurring jargon go into the
promptparameter — that is where recognition errors concentrate. - State the language when the video is single-language:
language="en"removes detection slips at the start. - Keep the timings. The
verbose_jsonformat returns segments with start and end times — the raw material for chapters, clips and jump links. - Read it once before publishing. Ten minutes of fixing names and paragraph breaks is the difference between a page people read and a wall of text.
Which option to choose
| Situation | Best option |
|---|---|
| One video, need the gist now | Built-in transcript panel |
| Your own video, text will be published | Own transcription of the audio |
| Whole channel archive | Batch pipeline over the audio |
| Need captions on the video | Own transcription with response_format=srt |
| Someone else's video | Transcript panel, or ask the author |
Try it on your own recordings. Sign-up takes a minute, and the free minutes are enough to judge the quality.
Get a free API keyFrequently asked questions
Can I just copy the YouTube transcript?
For a single video, yes — the transcript panel is free and instant. It is auto-generated, though, so punctuation and proper nouns are unreliable, and copying does not scale to an archive.
Do I need to download the video to transcribe it?
Only the audio track, and only for videos you have rights to. Audio is dozens of times smaller than video, and the picture is not used by recognition at all.
How long does an hour-long video take?
A few minutes: processing runs faster than real time. Extracting the audio with ffmpeg usually takes longer than the transcription itself.
Will I get timestamps?
Yes, with response_format=verbose_json you get segments with exact start and end times, and with srt or vtt you get a ready subtitle file.
Is transcription better than YouTube auto-captions?
On the same audio, a dedicated transcription pass gives punctuation, correct casing and far better handling of names and terms — especially when you pass the vocabulary through the prompt parameter.
Related reading
- Automatic SRT and VTT subtitles from video and webinars — How to get ready-made timed subtitles from a webinar or a video: extracting the audio track, SRT versus VTT, code samples and fixes for the usual problems.
- How to build a batch transcription pipeline for an audio archive — Transcribing thousands of recordings without losing any: a work queue, concurrency, retries, resuming after a crash and keeping the bill under control.
- How to improve speech-to-text accuracy: eight practical fixes — Eight changes that actually move transcription quality: audio preparation, language hints, the prompt parameter, chunking, formats, and how to measure word error rate.