Subtitle converter API

Convert SRT, WebVTT, ASS / SSA, SBV and TTML subtitles, shift or resync timings, change frame rate, fix old Vietnamese encodings and check line length.

POSThttps://apibox.io.vn/v1/subtitles
Content & HTML▶ Try it online

Send a subtitle file (subtitle text, a raw body or a file upload) and choose to: srt, vtt, ass, sbv, ttml, json (cues with start / end in ms) or text (plain transcript). The input format is detected automatically. Files in Windows-1258, TCVN3 (ABC) or VNI-Windows — common for old Vietnamese subtitles — are converted to Unicode (encoding=auto, or force it).

Retiming: shift (+1.5s, -500ms, 00:00:02,000), fps_from / fps_to (23.976 ↔ 25), and sync with two points to stretch a whole file that drifts. fix_overlaps, wrap (re-break lines at max_chars, balancing two lines), strip_tags and remove_empty clean the cues; merge with a second file (merge_mode interleave or append) and split_at (two parts, rebased to zero) combine or cut files.

Every response includes checks: overlaps, cues shorter than min_duration_ms (833) or longer than max_duration_ms (7000), reading speed above max_cps (20 characters per second), lines over max_chars (42) and more than max_lines (2), the usual Netflix / YouTube style limits. format=file returns the converted file for download.

Markdown · OpenAPI · Postman · llms.txt

Parameters

NameInTypeRequiredDefault
subtitlebodystringyesSubtitle text, or a file (multipart file, subtitle_base64) or a raw text body.
tobodystringnosrt, vtt, ass, sbv, ttml, json or text (default: same as input).
frombodystringnoautoInput format, detected by default.
encodingbodystringnoautoauto, utf-8, windows-1258, tcvn3, vni, windows-1252, utf-16le.
shiftbodystringnoMove all cues: +1.5s, -500ms, 00:00:02,000.
fps_frombodynumbernoFrame-rate change: source fps (with fps_to).
fps_tobodynumbernoTarget fps.
syncbodyarraynoTwo points [{"from":"00:00:10,000","to":"00:00:11,200"}, {...}].
fix_overlapsbodybooleannofalseEnd each cue before the next starts.
wrapbodybooleannofalseRe-break long lines at max_chars.
mergebodystringnoA second subtitle to merge (merge_mode interleave / append, merge_offset).
split_atbodystringnoSplit into two parts at this time.
max_charsbodynumberno42Characters per line for checks and wrapping.
max_cpsbodynumberno20Maximum reading speed (characters per second).
formatbodystringnojsonjson or file (download the converted file).

Example

curl -X POST "https://apibox.io.vn/v1/subtitles" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"subtitle":"1\n00:00:01,000 --> 00:00:03,500\nXin chào các bạn\n\n2\n00:00:03,400 --> 00:00:06,000\nHôm nay chúng ta học về phụ đề\n","to":"vtt","shift":"+2s"}'

Response

{
  "from": "srt",
  "to": "vtt",
  "encoding": null,
  "cues": 2,
  "duration_ms": 8000,
  "operations": [
    "shift:2000ms"
  ],
  "warnings": [],
  "checks": {
    "issues": [
      {
        "cue": 1,
        "start": "00:00:03,000",
        "type": "overlap",
        "message": "Overlaps the next cue by 100 ms",
        "value": 100
      }
    ],
    "counts": {
      "overlap": 1
    },
    "total": 1
  },
  "content": "WEBVTT\n\n00:00:03.000 --> 00:00:05.500\nXin chào các bạn\n\n00:00:05.400 --> 00:00:08.000\nHôm nay chúng ta học về phụ đề\n"
}

Use cases

  • Convert SRT from translators to WebVTT for HTML5 players
  • Fix subtitles that drift because of a 23.976 / 25 fps mismatch
  • Repair old TCVN3 / VNI Vietnamese subtitles that show garbage characters
  • Check reading speed and line length before publishing

FAQ

How do I fix a file that drifts more and more?

Use sync with two points: the time of an early cue and the time it should be, and the same for a late cue. All cues are stretched linearly between them.

Are ASS styles kept?

When converting ASS to ASS the original [Script Info] and styles are kept and each cue keeps its style name. Override tags such as {\i1} are removed from the text.

What is the maximum size?

Up to 20,000 cues per file, within your plan’s upload size.

Related APIs

Start with 1,000 free requests every month. Get free API key →