Auto Subtitles
POST /v1/ai/subtitles
Automatically transcribe audio from a video and optionally burn subtitles directly into the output. Powered by OpenAI Whisper.
Request
| Field | Type | Required | Description |
|---|---|---|---|
src | string | Yes | URL of the video to transcribe |
language | string | No | Source language code (default: auto-detect) |
burn_in | boolean | No | Burn subtitles into the video (default: false) |
style | object | No | Subtitle styling (when burn_in is true) |
callback | string | No | Webhook URL |
Transcription Only
Get the transcript as SRT without modifying the video.
curl
curl -X POST https://api.vidiking.com/v1/ai/subtitles \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"src": "https://example.com/video.mp4",
"language": "en",
"burn_in": false
}'
Node.js
const result = await client.ai.generateSubtitles({
src: 'https://example.com/video.mp4',
language: 'en',
burnIn: false,
});
const job = await client.pollJob(result.jobId);
console.log('SRT URL:', job.srt_url);
console.log('Transcript:', job.transcript);
Python
result = client.ai.generate_subtitles(
src="https://example.com/video.mp4",
language="en",
burn_in=False,
)
job = client.poll_job(result.job_id)
print("SRT URL:", job.srt_url)
Response (Transcription Only)
{
"id": "job_sub_abc123",
"status": "COMPLETE",
"srt_url": "https://cdn.vidiking.com/ai/job_sub_abc123.srt",
"transcript": "Welcome to our product demo. Today we will walk you through...",
"segments": [
{ "start": 0.0, "end": 2.5, "text": "Welcome to our product demo." },
{ "start": 2.5, "end": 5.8, "text": "Today we will walk you through the key features." }
],
"language": "en",
"credits_used": 5
}
Burn-In Subtitles
Render the subtitles directly into the video with customizable styling.
curl
curl -X POST https://api.vidiking.com/v1/ai/subtitles \
-H "Authorization: Bearer $VIDIKING_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"src": "https://example.com/video.mp4",
"language": "en",
"burn_in": true,
"style": {
"font": "Arial",
"font_size": 36,
"color": "#ffffff",
"background": "rgba(0,0,0,0.7)",
"position": "bottom",
"padding": 8
}
}'
Node.js
const result = await client.ai.generateSubtitles({
src: 'https://example.com/video.mp4',
burnIn: true,
style: {
font: 'Arial',
fontSize: 36,
color: '#ffffff',
background: 'rgba(0,0,0,0.7)',
position: 'bottom',
},
});
const job = await client.pollJob(result.jobId);
console.log('Subtitled video:', job.url);
Python
result = client.ai.generate_subtitles(
src="https://example.com/video.mp4",
burn_in=True,
style={
"font": "Arial",
"font_size": 36,
"color": "#ffffff",
"background": "rgba(0,0,0,0.7)",
"position": "bottom",
},
)
job = client.poll_job(result.job_id)
print("Subtitled video:", job.url)
Subtitle Style Options
| Property | Type | Default | Description |
|---|---|---|---|
font | string | Arial | Font family |
font_size | number | 32 | Font size in pixels |
color | string | #ffffff | Text color |
background | string | rgba(0,0,0,0.5) | Background color behind text |
position | string | bottom | top, center, bottom |
padding | number | 4 | Padding around text in pixels |
bold | boolean | false | Bold text |
outline | string | none | Outline color (e.g., #000000) |
Language Support
Whisper supports 99+ languages. Common language codes:
| Code | Language | Code | Language |
|---|---|---|---|
en | English | ja | Japanese |
es | Spanish | ko | Korean |
fr | French | zh | Chinese |
de | German | hi | Hindi |
it | Italian | ar | Arabic |
pt | Portuguese | ru | Russian |
Set language to auto (or omit it) for automatic language detection.
Cost
Subtitle generation costs $0.14 per job regardless of video duration (up to 30 minutes). Videos longer than 30 minutes are charged $0.14 per 30-minute segment.