Tutorial · Python · ~10 min
Extract Subtitles for Translation
Your translators need text, not video. Turn burned-in dialogue into clean, timed SRT — ready for MT or human translators.
Why this matters
Machine translation works on text. When the only copy of dialogue is burned into pixels, every language track starts with manual transcription.
Frame-OCR plus temporal clustering produces timed, deduplicated SRT from video alone — no source script needed.
How it works
The API OCRs frames, clusters identical text across time, collapses duplicates, and emits SRT/VTT with confidence scores per line.
Submit a job with an input URL (S3, GCS or HTTPS), poll the job URL, and download the rendered output. No GPU, no queues, no ffmpeg builds to babysit.
Code
import requests, time
API = "https://api.mlslabs.io/v1/subtitle-extractor/jobs"
headers = {"X-API-Key": "YOUR_API_KEY"}
payload = {"input": "s3://bucket/episode.mp4", "output_format": "srt", "lang": "zh"}
resp = requests.post(API, json=payload, headers=headers)
job = resp.json()
while job["status"] not in ("succeeded", "failed"):
time.sleep(3)
job = requests.get(job["url"], headers=headers).json()
print("Output:", job["output_url"])Pro tips
- Prefer the cleanest episode master for OCR accuracy.
- Hand the confidence scores to your QC step, not the translators.
- For zh → en MT, feed extracted SRT directly; no re-timing needed.
Pricing note
Usage is metered per minute of media processed; the first tier is free each month. Volume discounts kick in automatically.
FAQ
Common questions
Which languages are supported?
OCR covers Chinese, English, Japanese, Korean and most Latin scripts. New languages are added regularly.
Are the timings frame-accurate?
Timings come from text-visible frame ranges, so they are typically within 1–2 frames.
Can it merge multi-line captions?
Yes — adjacent lines are merged into one subtitle when they belong to the same utterance.
Keep exploring
Related guides
Subtitle Extractor API
Extract on-screen text and spoken dialogue with frame-accurate timestamps.
Learn moreSubtitle Eraser API
Remove hardcoded subtitles cleanly for localization and short-drama export.
Learn moreVideo OCR vs Speech To Text
Speech-to-text listens to audio; video OCR reads text burned into the picture. Learn which one extracts the subtitl...
Read guide