Tutorial · Python · ~10 min

Batch Extract Subtitles from Videos

A whole season to SRT in one pass: folder-prefix batch jobs with per-file output and a QC report.

PythonBatchAPI

Why this matters

Translation vendors need SRT for every episode, not just one. Batch extraction turns a multi-day manual task into an overnight job.

Per-file jobs mean one difficult episode never blocks the rest of the season.

How it works

Point the API at the folder, set output_format=srt, and poll the batch endpoint. Each file returns its own SRT plus a confidence summary.

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/shows/", "output_format": "srt", "pattern": "*.mp4"}

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

  • Run one episode per show as a smoke test first — fonts differ per title.
  • Ship the confidence report to QC, not the raw video.
  • Schedule the batch after the episode masters land in S3.

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

How do I get the files back?

Each job response includes its SRT URL; the batch endpoint lists all of them.

What about episodes with no subtitles?

They are reported as no-text-found — useful signal for QC.

Can I export one combined SRT?

Yes — set merge=true to concatenate episodes in order.