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.
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
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
subtitle | body | string | yes | Subtitle text, or a file (multipart file, subtitle_base64) or a raw text body. | |
to | body | string | no | srt, vtt, ass, sbv, ttml, json or text (default: same as input). | |
from | body | string | no | auto | Input format, detected by default. |
encoding | body | string | no | auto | auto, utf-8, windows-1258, tcvn3, vni, windows-1252, utf-16le. |
shift | body | string | no | Move all cues: +1.5s, -500ms, 00:00:02,000. | |
fps_from | body | number | no | Frame-rate change: source fps (with fps_to). | |
fps_to | body | number | no | Target fps. | |
sync | body | array | no | Two points [{"from":"00:00:10,000","to":"00:00:11,200"}, {...}]. | |
fix_overlaps | body | boolean | no | false | End each cue before the next starts. |
wrap | body | boolean | no | false | Re-break long lines at max_chars. |
merge | body | string | no | A second subtitle to merge (merge_mode interleave / append, merge_offset). | |
split_at | body | string | no | Split into two parts at this time. | |
max_chars | body | number | no | 42 | Characters per line for checks and wrapping. |
max_cps | body | number | no | 20 | Maximum reading speed (characters per second). |
format | body | string | no | json | json 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"}'const res = await fetch('https://apibox.io.vn/v1/subtitles', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"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"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/subtitles",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"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"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/subtitles');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"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 = curl_exec($ch);
print_r(json_decode($response, true));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
HTML to Markdown
Convert HTML or any web page URL into clean GitHub-flavored Markdown, with tables, optional article extraction and absolute links.
</>Markdown to HTML
Render GitHub-flavored Markdown to HTML with tables and strikethrough. Output is sanitized by default to strip scripts and event handlers.
<✓>HTML Sanitizer
Strip scripts, iframes, forms, event handlers, inline styles and javascript: links from untrusted HTML before you display it.