DocsGuides
Transcripts and captions
What is said in a video or a recording, in English or Polish, as JSON with times, SubRip and WebVTT.
POST /v1/transcribe reads the first audio stream of a file and writes what is said in it. In
POST /v1/jobs it is an output of type transcript, next to any other outputs of the same input. It
runs whisper.cpp with a voice activity model that skips what is not speech.
The request#
curl "$VIDEXO_API_URL/v1/transcribe" \
-H "Authorization: Bearer $VIDEXO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "https://example.com/talk.mp4",
"language": "en",
"filename": "talk.json"
}'Copy failed. The text is selected; copy it with your keyboard.
const response = await fetch(`${process.env.VIDEXO_API_URL}/v1/transcribe`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VIDEXO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"input": "https://example.com/talk.mp4",
"language": "en",
"filename": "talk.json"
}),
});
const job = await response.json();Copy failed. The text is selected; copy it with your keyboard.
talk.json, talk.srt and talk.vtt: each segment of speech with its start and end on the clock of the input.
language is required: en or pl. It is never detected, and other languages are refused.
The files#
One output writes three files, each with the output's name: talk.json, talk.srt and talk.vtt.
{
"language": "en",
"model": "small",
"start": 0,
"end": 11,
"text": "And so my fellow Americans, ask not what your country can do for you.",
"segments": [
{ "start": 0.3, "end": 7.5, "text": "And so my fellow Americans, ask not what your country" },
{ "start": 7.5, "end": 11, "text": "can do for you." }
]
}Copy failed. The text is selected; copy it with your keyboard.
Times are in seconds on the input's clock. Segments are phrases, not single words. model says which
model made the file. A recording with no speech is a result, not a failure: segments is empty, the
WebVTT file holds only its header, and the job is billed as usual.
A part of a file#
trim reads only that part; the times stay on the input's clock.
curl "$VIDEXO_API_URL/v1/transcribe" \
-H "Authorization: Bearer $VIDEXO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": "https://example.com/talk.mp4",
"language": "pl",
"trim": {
"start": 60,
"duration": 300
}
}'Copy failed. The text is selected; copy it with your keyboard.
const response = await fetch(`${process.env.VIDEXO_API_URL}/v1/transcribe`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VIDEXO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"input": "https://example.com/talk.mp4",
"language": "pl",
"trim": {
"start": 60,
"duration": 300
}
}),
});
const job = await response.json();Copy failed. The text is selected; copy it with your keyboard.
Captions on the video#
The .srt file is an input for subtitles in a second job, which burns
it in. One job does not do both yet.
When it fails#
- A file with no audio stream fails with
processing_failed(no_audio), and costs only the data fetched. - A
trimwith none of the sound in it fails withprocessing_failed(time_past_end), at the same cost. - Media longer than your plan's longest job fails with
limit_exceeded(job_duration). See Limits.
What it costs#
5 credits a minute of the media transcribed, prorated per second, for the three files together, plus data. See Limits. Silence inside the media counts: the bill follows the media's length, not the speech in it. A gap in a stream's timestamps holds no sound, so it is not billed, and the times after it stay right.