Tutorial · Python · ~10 min

Extract Chinese Subtitles from Video

Chinese OCR is the workhorse of short-drama localization. Here is how to get clean zh SRT out of any video.

PythonChineseAPI

Why this matters

Chinese characters are dense and visually complex — generic OCR models mangle them. A zh-specialized model handles simplified and traditional forms, punctuation, and vertical layouts.

For short dramas, the burned-in zh subtitles are the source of truth for every target language; extraction quality sets the ceiling for MT quality.

How it works

Set lang=zh on the job. The API OCRs with a zh model, clusters by timing, and returns SRT with confidence scores.

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

Python
import requests, time

API = "https://api.mlslabs.io/v1/subtitle-extractor/jobs"
headers = {"X-API-Key": "YOUR_API_KEY"}
payload = {"input": "s3://bucket/video.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

  • Feed the SRT to your MT pipeline directly — it keeps line boundaries and timing.
  • Flag low-confidence lines for a human QC pass; they are usually 5% or less.
  • Works for both horizontal and vertical (9:16) subtitle layouts.

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

Simplified or traditional?

Both — detect per line or force via the lang parameter (zh-Hans / zh-Hant).

Does it handle mixed zh-en subtitles?

Yes — bilingual lines are split into separate entries when the model is confident.

Is the output UTF-8?

Yes — safe for downstream MT, editors, and platforms.