Video to text API
Use Video to text from your code: send the file and get the TXT back.
At a glance
- Takes
- MP4 or MOV or WebM or MKV or AVI or WMV
- Makes
- TXT
- Costs
- 1 credit per started minute of audio; nothing with a test key, nothing when it fails
- Files
- One a job
- File size
- Up to 1 MB with a test key; 100 MB on Free, up to 5 GB on API Scale
- Engine
- Transcription (Workers AI Whisper)
Convert a file
Send the file to POST /v1/convert, naming the conversion, with an API key from the dashboard. The answer is the TXT.
curl "https://api.formatjet.com/v1/convert?conversion=video-to-text" \
-H "Authorization: Bearer $FORMATJET_API_KEY" \
-F file=@input.mp4 \
-o output.txtTypeScript
import { readFile, writeFile } from 'node:fs/promises';
const form = new FormData();
form.append('file', new Blob([await readFile('input.mp4')]), 'input.mp4');
const response = await fetch('https://api.formatjet.com/v1/convert?conversion=video-to-text', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.FORMATJET_API_KEY}` },
body: form,
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
await writeFile('output.txt', new Uint8Array(await response.arrayBuffer()));Python
import os
import requests
files = {"file": open("input.mp4", "rb")}
response = requests.post(
"https://api.formatjet.com/v1/convert",
params={"conversion": "video-to-text"},
headers={"Authorization": f"Bearer {os.environ['FORMATJET_API_KEY']}"},
files=files,
timeout=60,
)
response.raise_for_status()
with open("output.txt", "wb") as file:
file.write(response.content)The quickstart makes a test key and runs a request like this one. Requests take up to 25 MB; for larger files, files at a URL or a webhook when it’s done, make a job.
Options
Send them as JSON: options in the query of POST /v1/convert, or in the job’s step. Every one is optional.
| Option | Takes | Default | What it does |
|---|---|---|---|
format | "txt" | "srt" | "vtt" | "txt" | Save as |
language | "auto" | "en" | "es" | "fr" | "de" | "it" | "pt" | "nl" | "sv" | "da" | "no" | "fi" | "pl" | "cs" | "ro" | "hu" | "el" | "tr" | "ru" | "uk" | "ar" | "he" | "hi" | "bn" | "ta" | "si" | "id" | "ms" | "vi" | "th" | "zh" | "ja" | "ko" | "auto" | Spoken language |