Transcribe YouTube and TikTok videos with Whisper
Speech-to-text models only need the audio. Fetching the audio track directly — instead of the full video — makes transcription pipelines faster and cheaper. CrawlFetch returns it from one request.
Pipeline
- Resolve the URL with
format=m4a(or readaudioUrl). - Download the audio (or stream it straight into your STT provider if it accepts a URL).
- Optionally downsample to 16 kHz mono — what most speech models expect — with ffmpeg.
- Send the file to Whisper (local or hosted) or any speech-to-text API and store the transcript with the video ID.
Example with local Whisper
import os, subprocess, requestsimport whisper # pip install openai-whisperv = requests.get("https://api.crawlfetch.com/v1/resolve",params={"url": "https://youtu.be/aqz-KE-bpKQ", "format": "m4a"},headers={"Authorization": f"Bearer {os.environ['CRAWLFETCH_KEY']}"},timeout=15,).json()with requests.get(v["downloadUrl"], stream=True) as r, open("a.m4a", "wb") as f:for c in r.iter_content(1 << 20):f.write(c)subprocess.run(["ffmpeg", "-y", "-i", "a.m4a", "-ar", "16000", "-ac", "1", "a.wav"], check=True)print(whisper.load_model("base").transcribe("a.wav")["text"])
FAQ
Does the API return subtitles or transcripts?
No — it returns media and metadata. Use a speech-to-text model on the audio.
Why downsample to 16 kHz?
Most speech models resample to 16 kHz internally; doing it first reduces upload size.
Related
Last updated 2026-10-25