JSON2Video uses different AI models to transcribe the audio and generate subtitles for you, supporting a wide variety of languages and accents.
Subtitles example:
The subtitle element
The subtitle element is a bit different from the other elements. It's processed always once the scene or the movie is rendered to make sure it captures and transcribes the audio correctly.
The subtitles
element is only available at the movie elements array level,
and applies to the whole movie.
This means that you can't add it to certain scenes only.
The subtitle element has the following format:
model
The model
property defines the AI model to use for the subtitles generation.
The default model is default
, which is the most accurate model but may not support all languages.
Alternatively, you can use whisper
model, which support more languages but may lack some punctuation.
language
The language
property defines the expected language of the voice-over using the ISO 639-1 standard.
It defaults to auto
that tries to detect the language automatically.
The full list of supported languages for the default
model can be found in the API specification.
Some examples of common languages are:
en
: Englishes
: Spanishfr
: Frenchde
: Germanit
: Italianar
: Arabicja
: Japaneseko
: Koreanzh
: Chineseca
: Catalanpt
: Portuguese
Settings object
The settings
object allows you to customize the style of the subtitles using the following properties:
style
The style of the subtitle element. Styles are like presets of settings to start with that you can customize further using the settings
object.
The default style is classic
. These are the available styles:
font-family
Sets the font family of the subtitle text.
The full list of supported fonts is can be found in the API specification.
Some examples of common fonts are: Arial, Luckiest Guy, Nanum Pen Script, Roboto.
You can provide your own font by providing the URL to the font file in the font-url
property.
When using your own font, font-family
must be set to font family name of the font file.
font-url
The URL to the font file to use for the subtitles. The font file must be a valid font file in TTF format.
The font file must be hosted in a public URL, so it can be accessed by the API.
Learn how to use your own font in Using your own font in subtitles.
font-size
Sets the font size of the subtitle text. Defaults to a 10% of the video resolution.
max-words-per-line
Sets the maximum number of words per line. Defaults to 4. If you set it to 1, the subtitle will display just one word at once.
position
Sets the subtitle position on the video. Defaults to bottom-center
.
word-color, line-color
Sets the color of the subtitle text. The word-color
refers to the color of the word that is being spoken and
the line-color
refers to the rest of the text.
Setting different values to word-color
and line-color
makes the spoken word to be highlighted.
Setting these properties to the same value makes the whole line of text to look the same color.
Colors can be set in hexadecimal format like #00B140
, but can also include alpha (opacity) values, like #00B14008
.
outline-width, outline-color
Some styles support an outline (classic styles, for example).
outline-width
sets the width of the outline, that can be set to 0 to disable the outline.
outline-color
sets the color of the outline.
box-color
A few styles, instead of outline, support a box around the text. This property sets the color of the box framing the subtitle.
Again, like all color properties, it must be in hexadecimal format like #00B140
, but can also include alpha (opacity) values, like #00B14008
.
shadow-color, shadow-offset
Some styles support a shadow. These properties set the color of the shadow, and the offset of the shadow.
keywords
Keywords is an array of words that helps the AI to transcribe the audio better.
For example, transcribing a voice over talking about "JSON2Video" may be transcribed as "JSON to video" or "Jason to video".
Adding the word "JSON2Video" to the keywords
array will help the AI to transcribe the audio better.
{
"type": "subtitles",
"language": "en",
"settings": {
"keywords": [
"JSON2Video"
]
}
}
replace
Replace is collection of words that will be replaced by other words.
For example, we can replace any appearance of the word "apple" by the word "orange".
{
"type": "subtitles",
"language": "en",
"settings": {
"replace": {
"apple": "orange"
}
}
}