# 1. send the video as a link - YouTube, Google Drive, Vimeo, S3 or direct URL
curl -X POST https://api.rask.ai/api/library/v1/media/link \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"link": "https://youtu.be/...", "name": "camera review"}'
# 2. create the project - the language of the video is detected automatically
curl -X POST https://api.rask.ai/v2/projects \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "{\"video_id\": \"$VIDEO_ID\", \"dst_lang\": \"es-mx\"}"# The transcript as plain text with timestamps and speakers
curl -s https://api.rask.ai/v2/projects/$ID/transcription -H "Authorization: Bearer $TOKEN" \
| jq -r '.segments[] | "\(.start) \(.speaker): \(.src.text)"'以多部分表单数据上传视频文件,或发布 YouTube、Google Drive、Vimeo、S3 或直接链接。在产生任何费用之前,你将获得媒体 ID 和视频元数据。
将媒体 ID 作为 video_id 传递,并设置目标语言。源语言留空则自动检测语言。转写将立即开始。video_id
在文字记录片段可用时立即读取,以便在翻译媒体继续处理的同时开始为录音建立索引。项目完成后,下载字幕和媒体文件。
# pip install git+ssh://[email protected]/braskai/rask-sdk.git@main
import asyncio
from rask_sdk import clients, enums, schemas
VIDEOS = ["https://youtu.be/aaa", "https://youtu.be/bbb", "https://vimeo.com/123"]
async def transcribe(client, i, link):
media = await client.create_media_link(data=schemas.MediaCreateLink(link=link))
while media.status is enums.MediaStatus.PROCESSING:
await asyncio.sleep(5)
media = await client.get_media(media_id=media.id)
job = await client.create_project(data=schemas.ProjectCreate(video_id=media.id, dst_lang="en-us"))
while job.status is not enums.ProjectStatus.MERGING_DONE:
await asyncio.sleep(10)
job = await client.get_project(project_id=job.id)
t = await client.get_project_transcription(project_id=job.id)
with open(f"video_{i}.txt", "w") as f: # plain text, one segment per line
f.write("\n".join(f"{s.speaker}: {s.src.text}" for s in t.segments))
async def main():
client = clients.RaskSDKClient(client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
await asyncio.gather(*(transcribe(client, i, v) for i, v in enumerate(VIDEOS))) # no rate limits
asyncio.run(main())import os, time, requests
AUTH = "https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token"
API = "https://api.rask.ai"
token = requests.post(AUTH, auth=(CLIENT_ID, CLIENT_SECRET),
data={"grant_type": "client_credentials"}).json()["access_token"]
h = {"Authorization": f"Bearer {token}"}
media = requests.post(f"{API}/api/library/v1/media/link", headers=h,
json={"link": "https://youtu.be/..."}).json()
project = requests.post(f"{API}/v2/projects", headers=h,
json={"video_id": media["id"], "dst_lang": "es-mx"}).json()
while project["status"] != "merging_done":
time.sleep(10)
project = requests.get(f"{API}/v2/projects/{project['id']}", headers=h).json()
print(project["translated_video"])// no dependencies, Node 18+ global fetch
const API = 'https://api.rask.ai';
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
const auth = await fetch('https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token', {
method: 'POST',
headers: { Authorization: 'Basic ' + btoa(`${CLIENT_ID}:${CLIENT_SECRET}`) },
body: new URLSearchParams({ grant_type: 'client_credentials' }),
}).then((r) => r.json());
const h = { Authorization: `Bearer ${auth.access_token}`, 'Content-Type': 'application/json' };
const call = (method, path, body) => fetch(API + path, { method, headers: h, body: body && JSON.stringify(body) }).then((r) => r.json());
let media = await call('POST', '/api/library/v1/media/link', { link: 'https://drive.google.com/file/d/...' });
while (media.status === 'processing') { await sleep(5000); media = await call('GET', `/api/library/v1/media/${media.id}`); }
let p = await call('POST', '/v2/projects', { video_id: media.id, dst_lang: 'fr-fr' });
while (p.status !== 'merging_done') { await sleep(10000); p = await call('GET', `/v2/projects/${p.id}`); }
const { segments } = await call('GET', `/v2/projects/${p.id}/transcription`);
const index = segments.map((s) => ({ t: s.start, speaker: s.speaker, text: s.src.text, fr: s.dst.text }));
console.log(JSON.stringify(index, null, 2)); // ready for your search index# 1. token (valid 1 hour - cache and reuse it)
TOKEN=$(curl -s -X POST https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token \
-u "$CLIENT_ID:$CLIENT_SECRET" -d "grant_type=client_credentials" | jq -r .access_token)
# 2. upload a local video file
VIDEO_ID=$(curl -s -X POST "https://api.rask.ai/api/library/v1/media?kind=video" \
-H "Authorization: Bearer $TOKEN" -F "[email protected]" | jq -r .id)
# 3. create the project once the media status is ready
ID=$(curl -s -X POST https://api.rask.ai/v2/projects \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d "{\"video_id\": \"$VIDEO_ID\", \"dst_lang\": \"de-de\", \"num_speakers\": 3}" | jq -r .id)
# 4. when status is merging_done, save the transcript as plain text
curl -s https://api.rask.ai/v2/projects/$ID/transcription -H "Authorization: Bearer $TOKEN" \
| jq -r '.segments[].src.text' > webinar.txt<?php
use GuzzleHttp\Client;
$http = new Client(['base_uri' => 'https://api.rask.ai']);
$json = fn($r) => json_decode($r->getBody(), true);
$auth = $json((new Client)->post('https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token',
['auth' => [$clientId, $clientSecret], 'form_params' => ['grant_type' => 'client_credentials']]));
$h = ['Authorization' => 'Bearer ' . $auth['access_token']];
$media = $json($http->post('/api/library/v1/media/link', ['headers' => $h, 'json' => [
'link' => 'https://vimeo.com/123456']]));
while ($media['status'] === 'processing') {
sleep(5);
$media = $json($http->get("/api/library/v1/media/{$media['id']}", ['headers' => $h]));
}
$p = $json($http->post('/v2/projects', ['headers' => $h, 'json' => [
'video_id' => $media['id'], 'dst_lang' => 'pt-br']]));
while ($p['status'] !== 'merging_done') {
sleep(10);
$p = $json($http->get("/v2/projects/{$p['id']}", ['headers' => $h]));
}
$t = $json($http->get("/v2/projects/{$p['id']}/transcription", ['headers' => $h]));
file_put_contents('video.txt', implode("\n", array_map(fn($s) => $s['src']['text'], $t['segments'])));no_audio, no_words and forbidden_link are specific enough to show directly to your own user, for example a video without speech.00:00:00,320 SPEAKER_00 Welcome back. Today we test three cameras in low light.
00:00:06,180 SPEAKER_01 I brought the footage from last week's night shoot.
00:00:10,940 SPEAKER_00 Let's start with the smallest sensor, the hardest case.
00:00:15,500 SPEAKER_01 At ISO 6400 the noise is visible, but the colors hold up./transcriptiontranslation_srt_pathtranslation_vtt_pathtranslated_videotranslated_audiooriginal_video

es-mx 和 es-es 类似内容。项目记录 glossary_version,因此后续的修改绝不会悄悄改变已完成的工作。是的。发送视频文件或链接,创建一个项目,即可通过 GET /v2/projects/{id}/transcription 读取带有发言人标签和时间戳的转写内容。转写是每个 Rask 项目的第一阶段,随后会添加翻译、字幕和配音版本。
是的。将YouTube、Google Drive、Vimeo、S3或直接下载链接发送至媒体端点,API会自动获取视频。您也可以直接上传视频文件。
是的。每个视频创建一个项目并并行运行。该API没有速率限制、并发配额限制或每个密钥的频率限制,因此批量转写整个视频库只需在您的代码中编写一个循环即可。
系统会自动检测不同的发言人,每个片段都会带有诸如 SPEAKER_00 的发言人标签。如果您已知发言人数量,可以在创建项目时传入 num_speakers 参数。
该 API 支持 75 种源语言(包括英语)的转写,并具备自动语言检测功能:您可以将 src_lang 留空,或者传入如 en 这样的两位字母代码。转写内容可翻译成 135 种以上的语言和地区选项,例如 en-us 或 es-mx。
准确率取决于视频本身:背景噪音、嘈杂环境、重叠对话、口音以及专业术语都会产生影响。建议您在自己的视频上测试 API,并在发布前通过 API 纠正任何片段。
转写结果是以 JSON 片段形式提供的,包含发言人和时间戳。您可以将各个片段的文本合并为纯文本,或者保留时间戳以便搜索转写内容。系统还会提供目标语言的 SRT 和 VTT 格式字幕。
不能。API 返回的是转写、翻译、字幕和配音版本。若要创建人工智能生成的摘要或会议纪要,您可以将转写内容发送至您选择的摘要工具中。
可以,通过录音文件。将录制的会议作为视频或音频文件上传。该 API 不连接会议平台,也不提供实时字幕或实时通话的低延迟转写功能。
API 文档未公布固定的文件大小限制。在应用您套餐的限制后,每个项目都会报告原时长 (original_duration) 和最终时长。对于超长视频或超大体量,请与我们的团队联系。
项目按视频分钟数计费,向上取整至完整分钟,费用从与 Rask 应用相同的分钟数额度中扣除。价格包含转写、翻译、字幕和配音版本。在符合条件的标准套餐中,额外分钟数的费用为 3 美元/分钟。企业版定价将根据您的合同量身定制。
在 Rask 应用中免费试用,无需信用卡,即可在您自己的视频上测试转写。API 访问权限适用于创作者专业版、企业版和大型企业版套餐,具体功能由您的套餐决定。
API 访问权限适用于创作者专业版、企业版和大型企业版套餐,具体功能由您的套餐决定。您可以在应用中生成客户端 ID 和密钥并立即开始调用。大型企业版套餐、批量定价和自定义语言覆盖范围请联系我们的团队获取。