addSubtitlesToVideo
Automatically add subtitles to a video
mindstudio.addSubtitlesToVideo({ videoUrl, language, fontName, fontSize, fontWeight, fontColor, highlightColor, strokeWidth, strokeColor, backgroundColor, backgroundOpacity, position, yOffset, wordsPerSubtitle, enableAnimation }) → Result
Transcribes a video's speech and burns subtitles onto it automatically, returning a new video. For the transcript as text rather than on-screen captions, use transcribeAudio instead.
Parameters
videoUrl
string
RequiredURL of the source video
language
string
RequiredISO language code for subtitle transcription
fontName
string
RequiredGoogle Font name for subtitle text
fontSize
number
RequiredFont size in pixels. Default: 100.
fontWeight
string
RequiredFont weight for subtitle text
normalboldblack
fontColor
string
RequiredColor of the subtitle text
whiteblackredgreenblueyelloworangepurplepinkbrowngraycyan
highlightColor
string
RequiredColor used to highlight the currently spoken word
whiteblackredgreenblueyelloworangepurplepinkbrowngraycyan
strokeWidth
number
RequiredWidth of the text stroke outline in pixels
strokeColor
string
RequiredColor of the text stroke outline
blackwhiteredgreenblueyelloworangepurplepinkbrowngraycyan
backgroundColor
string
RequiredBackground color behind subtitle text. Use 'none' for transparent.
blackwhiteredgreenblueyelloworangepurplepinkbrowngraycyan
backgroundOpacity
number
RequiredOpacity of the subtitle background. 0.0 = fully transparent, 1.0 = fully opaque.
position
string
RequiredVertical position of subtitle text on screen
topcenterbottom
yOffset
number
RequiredVertical offset in pixels from the position. Positive moves down, negative moves up. Default: 75.
wordsPerSubtitle
number
RequiredMaximum number of words per subtitle segment. Use 1 for single-word display, 2-3 for short phrases, or 8-12 for full sentences. Default: 3.
enableAnimation
boolean
RequiredWhen true, enables bounce-style entrance animation for subtitles. Default: true.
intermediateAsset
boolean
When true, the asset is created but hidden from the user's gallery (tagged as intermediate)
Call from a method
import { mindstudio } from '@mindstudio-ai/agent'; const result = await mindstudio.addSubtitlesToVideo({ videoUrl: /* ... */, language: /* ... */, fontName: /* ... */, fontSize: /* ... */, fontWeight: /* ... */, fontColor: /* ... */, highlightColor: /* ... */, strokeWidth: /* ... */, strokeColor: /* ... */, backgroundColor: /* ... */, backgroundOpacity: /* ... */, position: /* ... */, yOffset: /* ... */, wordsPerSubtitle: /* ... */, enableAnimation: /* ... */ });