# 1. send your script as timed segments - one speaker per line
curl -X POST https://api.rask.ai/v2/transcriptions \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"segments": [
{"speaker": "SPEAKER_00", "start": "00:00:00,500", "end": "00:00:04,800",
"src": {"text": "Welcome to the new dashboard.", "lang": "en"},
"dst": {"text": "Bienvenido al nuevo panel.", "lang": "es-mx"}}
]}'
# 2. voice the script over your video
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\", \"transcript_id\": \"$TRANSCRIPT_ID\"}"# When status is merging_done, read the voiceover links
curl -s https://api.rask.ai/v2/projects/$ID -H "Authorization: Bearer $TOKEN" \
| jq '{status, voiceover, translated_audio, translated_video}'ファイルまたは対応するメディアのURLを使用して、ナレーションを入れたい動画や音声の録音をアップロードします。タイムラインが原稿のタイミングの基準になります。
タイムスタンプと話者情報が含まれるテキストセグメント、またはSRTファイルから文字起こしデータを作成し、そのtranscript_idと翻訳先の言語を指定してプロジェクトを作成します。
音声の一覧を表示し、話者ごとにプリセットやクローン音声を割り当て、必要に応じて再生成してから、ナレーション、動画、字幕ファイルをダウンロードします。
# pip install git+ssh://[email protected]/braskai/rask-sdk.git@main
import asyncio
from rask_sdk import clients, enums, schemas
async def wait(client, job):
while job.status is not enums.ProjectStatus.MERGING_DONE:
await asyncio.sleep(10)
job = await client.get_project(project_id=job.id)
return job
async def main():
client = clients.RaskSDKClient(client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
script = await client.create_transcription(data=schemas.TranscriptionCreate(segments=[
schemas.SegmentCreate(speaker="SPEAKER_00", start="00:00:00,500", end="00:00:04,800",
src=schemas.SegmentTextCreatePatch(text="Welcome to the new dashboard.", lang="en"),
dst=schemas.SegmentTextCreatePatch(text="Bienvenido al nuevo panel.", lang="es-mx")),
]))
job = await wait(client, await client.create_project(data=schemas.ProjectCreate(
video_id=VIDEO_ID, dst_lang="es-mx", transcript_id=script.id)))
# pick a female AI voice preset from the library for SPEAKER_00
voices = await client.get_project_voices(project_id=job.id)
preset = next(v for v in voices if v.gender == "female")
await client.patch_project(project_id=job.id, data=schemas.ProjectPatch(voice={**job.voice, "SPEAKER_00": preset.id}))
job = await wait(client, await client.generate_project(project_id=job.id))
print(job.voiceover, job.translated_video)
asyncio.run(main())import 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}"}
def wait(pid):
while (p := requests.get(f"{API}/v2/projects/{pid}", headers=h).json())["status"] != "merging_done":
time.sleep(10)
return p
script = requests.post(f"{API}/v2/transcriptions", headers=h, json={"segments": [
{"speaker": "SPEAKER_00", "start": "00:00:00,500", "end": "00:00:04,800",
"src": {"text": "Welcome to the new dashboard.", "lang": "en"},
"dst": {"text": "Bienvenido al nuevo panel.", "lang": "es-mx"}},
]}).json()
pid = requests.post(f"{API}/v2/projects", headers=h, json={
"video_id": VIDEO_ID, "dst_lang": "es-mx", "transcript_id": script["id"]}).json()["id"]
project = wait(pid)
voices = requests.get(f"{API}/v2/projects/{pid}/voices", headers=h).json()
preset = next(v for v in voices if v["gender"] == "female")
requests.patch(f"{API}/v2/projects/{pid}", headers=h,
json={"voice": {**project["voice"], "SPEAKER_00": preset["id"]}})
requests.post(f"{API}/v2/projects/{pid}/generate", headers=h)
print(wait(pid)["voiceover"])// 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());
const wait = async (id) => { let p; while ((p = await call('GET', `/v2/projects/${id}`)).status !== 'merging_done') await sleep(10000); return p; };
const script = await call('POST', '/v2/transcriptions', { segments: [
{ speaker: 'SPEAKER_00', start: '00:00:00,500', end: '00:00:04,800',
src: { text: 'Welcome to the new dashboard.', lang: 'en' },
dst: { text: 'Bienvenido al nuevo panel.', lang: 'es-mx' } },
] });
const { id } = await call('POST', '/v2/projects', { video_id: VIDEO_ID, dst_lang: 'es-mx', transcript_id: script.id });
const project = await wait(id);
const voices = await call('GET', `/v2/projects/${id}/voices`);
const preset = voices.find((v) => v.gender === 'female');
await call('PATCH', `/v2/projects/${id}`, { voice: { ...project.voice, SPEAKER_00: preset.id } });
await call('POST', `/v2/projects/${id}/generate`);
console.log((await wait(id)).voiceover);# 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. your script as an SRT file in the target language
TRANSCRIPT_ID=$(curl -s -X POST "https://api.rask.ai/v2/transcriptions/srt?dst_lang=es-mx" \
-H "Authorization: Bearer $TOKEN" -F "dst=@script_es-mx.srt" | jq -r .id)
# 3. voice it over the video
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\": \"es-mx\", \"transcript_id\": \"$TRANSCRIPT_ID\"}" | jq -r .id)
# 4. when status is merging_done, read the voiceover links
curl -s https://api.rask.ai/v2/projects/$ID -H "Authorization: Bearer $TOKEN" \
| jq '{status, voiceover, translated_video}'<?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']];
$script = $json($http->post('/v2/transcriptions', ['headers' => $h, 'json' => ['segments' => [[
'speaker' => 'SPEAKER_00', 'start' => '00:00:00,500', 'end' => '00:00:04,800',
'src' => ['text' => 'Welcome to the new dashboard.', 'lang' => 'en'],
'dst' => ['text' => 'Bienvenido al nuevo panel.', 'lang' => 'es-mx'],
]]]]));
$p = $json($http->post('/v2/projects', ['headers' => $h, 'json' => [
'video_id' => $videoId, 'dst_lang' => 'es-mx', 'transcript_id' => $script['id']]]));
while ($p['status'] !== 'merging_done') {
sleep(10);
$p = $json($http->get("/v2/projects/{$p['id']}", ['headers' => $h]));
}
echo $p['voiceover'];{"label": "Renata", "gender": "female", "sample_src": "https://..."} AI voice preset
{"label": "Gerardo", "gender": "male", "sample_src": "https://..."} AI voice preset
{"label": "Maria Lopez", "gender": "auto", "sample_src": "https://..."} custom voice clone
{"label": "Voice Clone", "gender": "auto", "sample_src": null} instant voice clone

es-mx および es-es 同様に機能します。プロジェクトには glossary_versionが記録されるため、後から編集を行っても、完了した作業が勝手に変更されることはありません。はい、動画のナレーション作成にご利用いただけます。時間指定されたテキストセグメントまたはSRTファイルを動画と一緒に送信すると、APIが自然な音声を作成します。映像のタイミングに合わせ、AI音声や音声クローンを使用して、字幕と音声トラックを同じプロジェクト内で生成します。
Raskはプロジェクト全体に対する音声を生成してファイルを納品するため、公開済みの動画、研修、マーケティングコンテンツに向いています。数秒以内に音声が必要となる音声エージェントやコンタクトセンターなどのリアルタイム性が求められる用途には、ストリーミング対応の音声合成APIのほうが適しています。
音声はプロジェクトの生成が完了した時点で納品されます。対象プランではWAV形式のナレーション、ミックス済み音声、動画が提供されます。APIの生成中に音声のチャンクやバイト単位でストリーミング配信されることはありません。
POST /v2/transcriptionsを使用し、各セグメントに話し手、開始・終了時間(HH:MM:SS,mmm形式)、テキストが含まれる文字起こしを作成します。また、SRTファイルをPOST /v2/transcriptions/srtにアップロードすることも可能です。その後、プロジェクトを作成する際にtranscript_idを指定してください。
すべての翻訳先の言語・地域において、音声ライブラリにあらかじめ性別が設定されたAI音声プリセットが用意されています。GET /v2/projects/{id}/voicesを使用してプロジェクトの選択肢を取得し、話し手ごとに音声IDを割り当てます。音声クローンに対応している言語では、音声クローンもご利用いただけます。
はい。話し手の同意を得た上で、Raskアプリでカスタム音声クローンをあらかじめ作成しておけば、音声クローン対応言語においてAPI経由であらゆる話し手にその音声IDを割り当てることができます。ブランドの音声を統一するのに最適です。
135以上の言語や地域の中からお選びいただけます。原稿を1つの言語で入力してRaskに翻訳させることも、あらかじめ翻訳済みの原稿を送信することも可能です。すべての翻訳先ロケールでAI音声をご利用いただけます。
APIではセグメントごとに通常のテキストを受け付けます。読み方を調整するには、原稿のテキストのスペルを調整してください。用語集は、言葉の「読み方」ではなく「翻訳方法」を制御するためのものです。
選択した音声や、句読点を含むテキストに沿って読み上げが行われます。実際のパフォーマンスのような豊かな感情表現を持たせるには、元の話し手の音声クローンを使用すると、本人の声の個性をより多く残すことができます。
動画または音声の録音データを使用できます。元のメディアをアップロードし、タイムラインに沿った時間指定済みの原稿を提供することで、それに合わせたナレーションを生成します。メディアファイルのアップロードは必須です。
いいえ。利用料金は動画の分数単位で計算され、次の1分に切り上げられます(Raskアプリの持ち分時間から消化されます)。対象となるスタンダードプランでは、追加分数を1分あたり3ドルでご利用いただけます。企業向けの料金については、ご契約内容に合わせて個別に対応いたします。再吹き替えは変更された部分のみが課金対象となり、1回の実行につき1分の最低料金が適用されます。
Raskアプリで無料トライアル(クレジットカード不要)から始めて、ご自身の動画で音声を確認できます。APIへのアクセスは、Creator Pro、Business、およびEnterpriseの各プランでご利用可能で、利用できる機能はプランによって異なります。
APIアクセスは、クリエイタープロ、ビジネス、およびエンタープライズの各プランでご利用いただけます。利用できる機能はプランによって異なります。アプリ内でクライアントIDとシークレットを生成すれば、すぐにAPIの呼び出しを開始できます。エンタープライズ向けの契約条件、大量利用時の割引、カスタム言語の対応については、弊社のチームまでお問い合わせください。