# 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ドライブ、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ドライブ、Vimeo、S3、または直接ダウンロードできるリンクをメディア用エンドポイントに送信すると、APIが自動で動画を取得します。動画ファイルを直接アップロードすることも可能です。
はい。動画ごとにプロジェクトを作成し、並行して処理を実行できます。APIには利用制限や同時実行数のクォータ、キーごとの制限がないため、コード内のループ処理でライブラリ全体の文字起こしを一括で行うことができます。
話者は自動で識別され、各セグメントにはSPEAKER_00のような話者ラベルが割り当てられます。話者の数が事前に分かっている場合は、プロジェクト作成時に num_speakers を指定してください。
このAPIは英語を含む75の言語に対応しており、言語の自動検出機能も備えています。src_langを空欄にするか、enなどの2文字のコードを指定してください。文字起こしデータは、en-usやes-mxなど135以上の言語や地域設定に翻訳できます。
精度は動画の状態によって異なります。背景の雑音、騒がしい環境、話者の声の重なり、アクセント、専門用語などが精度に影響します。実際の動画でAPIをテストし、公開前にAPI経由でセグメントを修正することをおすすめします。
文字起こしデータは、話者情報やタイムスタンプが含まれるJSON形式のセグメントとして取得できます。セグメントのテキストを結合すれば通常のテキストになり、タイムスタンプを残せば検索可能な文字起こしとして利用できます。ターゲット言語のSRTおよびVTT形式の字幕も含まれています。
いいえ。APIが返すのは文字起こし、その翻訳、字幕、そして吹き替え版です。AIによる要約や議事録を作成したい場合は、取得した文字起こしデータを任意の要約ツールに渡してください。
はい、録音データであれば可能です。録画したミーティングを動画または音声ファイルとしてアップロードしてください。APIはミーティングプラットフォームに直接接続しないため、ライブ通話のリアルタイム字幕や低遅延の文字起こしには対応していません。
APIドキュメントには固定のファイルサイズ制限は記載されていません。各プロジェクトでは、ご契約プランの制限が適用された後の original_duration(元の長さ)と duration(処理後の長さ)が報告されます。非常に長い動画や大量のデータを処理する場合は、弊社チームまでお問い合わせください。
プロジェクトごとに動画の分単位で課金され(1分未満は切り上げ)、Raskアプリの分数が共有されます。料金には文字起こし、翻訳、字幕、吹き替えが含まれます。対象となるスタンダードプランでは、追加の分数を1分あたり3ドルでご利用いただけます。エンタープライズプランの価格はご契約内容に合わせて個別に調整されます。
クレジットカード不要のRaskアプリの無料トライアルから始めて、お持ちの動画で文字起こしをお試しください。APIへのアクセスは、Creator Pro、Business、Enterpriseの各プランでご利用いただけます(利用できる機能はプランによって異なります)。
APIはクリエイタープロ、ビジネス、エンタープライズの各プランでご利用いただけます。機能はプランによって異なります。アプリ内でクライアントIDとシークレットを作成すれば、すぐに利用を始められます。エンタープライズプラン、大量利用向けの料金プラン、カスタム言語の対応については、弊社チームまでお問い合わせください。