Skip to main content

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

FieldTypeRequiredDescription
srcstringYesURL of the video to transcribe
languagestringNoSource language code (default: auto-detect)
burn_inbooleanNoBurn subtitles into the video (default: false)
styleobjectNoSubtitle styling (when burn_in is true)
callbackstringNoWebhook 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

PropertyTypeDefaultDescription
fontstringArialFont family
font_sizenumber32Font size in pixels
colorstring#ffffffText color
backgroundstringrgba(0,0,0,0.5)Background color behind text
positionstringbottomtop, center, bottom
paddingnumber4Padding around text in pixels
boldbooleanfalseBold text
outlinestringnoneOutline color (e.g., #000000)

Language Support

Whisper supports 99+ languages. Common language codes:

CodeLanguageCodeLanguage
enEnglishjaJapanese
esSpanishkoKorean
frFrenchzhChinese
deGermanhiHindi
itItalianarArabic
ptPortugueseruRussian

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.