Tutorial · Python · ~10 min
Extract Subtitles from MP4
MP4 is everywhere, and its subtitles hide in two places: metadata tracks or pixels. This covers both.
Why this matters
MP4 can carry soft subtitles as metadata tracks, but most short-form exports burn them into pixels instead. The right tool depends on which case you have.
The API probes the container first — if an embedded track exists it extracts it; otherwise it falls back to OCR.
How it works
Submit the MP4 URL and the API auto-detects: embedded track extraction is instant, OCR takes a bit longer.
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/video.mp4", "output_format": "srt"}
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
- Check for embedded tracks first — they are free to extract.
- For hardcoded subs, 1080p or higher gives the best OCR accuracy.
- Export VTT for web players, SRT for editors and translation.
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
Does it handle the MOV variant?
Yes — MOV containers behave the same for extraction purposes.
What if the MP4 has no subtitles at all?
The API reports no-track-found; OCR then scans for burned-in text automatically.
Can I extract only the subtitle track without re-encoding video?
Yes — for embedded tracks the video is passed through untouched.
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 moreH.264 Encoding API
Perceptual, cost-efficient encoding tuned for real viewing quality.
Learn more