# 1. on a dubbed project: confirm the video has a face (runs once, usually automatically)
curl https://api.rask.ai/v2/projects/$ID/lipsync \
-H "Authorization: Bearer $TOKEN"
# "check_face_task_status": "done", "video_has_face": true
# 2. preview one free minute of lip-sync
curl -X PUT https://api.rask.ai/v2/projects/$ID/lipsync \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"is_multiple_speakers": true, "is_free_lipsync": true}'
# 3. lip-sync the full video - billed separately from dubbing
curl -X PUT https://api.rask.ai/v2/projects/$ID/lipsync \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"is_multiple_speakers": true, "is_free_lipsync": false}'# Poll until lipsync_task_status is done, then download lipsync_result_path
while :; do
curl -s https://api.rask.ai/v2/projects/$ID/lipsync -H "Authorization: Bearer $TOKEN" \
| jq '{lipsync_task_status, lipsync_task_progress, tasks_in_lipsync_queue}'
sleep 15
done動画ファイルをアップロードするか公開URLを送信し、翻訳先の言語を指定してプロジェクトを作成したら、処理が完了するのを待ちます。リップシンクには、このプロジェクトの翻訳済み動画が必要です。
顔の確認作業により、動画内に少なくとも1つの顔が映っていることが確認されます。通常は自動で開始されますが、もし開始されない場合は、プロジェクトに対して手動で実行してください。
リップシンクの処理を実行し、進捗状況(0から100まで)を確認したら、結果の動画をダウンロードします。
# pip install git+ssh://[email protected]/braskai/rask-sdk.git@main
import asyncio
from rask_sdk import clients, enums, schemas
PROJECT_ID = "..." # a project with status merging_done
async def main():
client = clients.RaskSDKClient(client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
info = await client.get_lipsync_info(project_id=PROJECT_ID)
if info.check_face_task_status is not enums.LipsyncStatus.DONE:
await client.run_check_face_task(project_id=PROJECT_ID)
while (info := await client.get_lipsync_info(project_id=PROJECT_ID)).check_face_task_status is not enums.LipsyncStatus.DONE:
await asyncio.sleep(10)
if not info.video_has_face:
raise SystemExit("No face found - lip-sync is not available for this video")
await client.run_lipsync_task(project_id=PROJECT_ID,
data=schemas.LipsyncTaskData(is_multiple_speakers=True, is_free_lipsync=False))
while (info := await client.get_lipsync_info(project_id=PROJECT_ID)).lipsync_task_status is not enums.LipsyncStatus.DONE:
print(info.lipsync_task_progress, info.tasks_in_lipsync_queue)
await asyncio.sleep(15)
print(info.lipsync_result_path)
asyncio.run(main())import time, requests
AUTH = "https://rask-prod.auth.us-east-2.amazoncognito.com/oauth2/token"
URL = f"https://api.rask.ai/v2/projects/{PROJECT_ID}" # a dubbed project
token = requests.post(AUTH, auth=(CLIENT_ID, CLIENT_SECRET),
data={"grant_type": "client_credentials"}).json()["access_token"]
h = {"Authorization": f"Bearer {token}"}
info = requests.get(f"{URL}/lipsync", headers=h).json()
if info["check_face_task_status"] != "done":
requests.put(f"{URL}/check_face", headers=h)
while (info := requests.get(f"{URL}/lipsync", headers=h).json())["check_face_task_status"] != "done":
time.sleep(10)
assert info["video_has_face"], "No face found"
requests.put(f"{URL}/lipsync", headers=h,
json={"is_multiple_speakers": True, "is_free_lipsync": False})
while (info := requests.get(f"{URL}/lipsync", headers=h).json())["lipsync_task_status"] not in ("done", "failed"):
time.sleep(15)
print(info["lipsync_task_status"], info["lipsync_result_path"])// no dependencies, Node 18+ global fetch - PROJECT_ID is a dubbed project
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 url = `https://api.rask.ai/v2/projects/${PROJECT_ID}`;
const info = () => fetch(`${url}/lipsync`, { headers: h }).then((r) => r.json());
let i = await info();
if (i.check_face_task_status !== 'done') {
await fetch(`${url}/check_face`, { method: 'PUT', headers: h });
while ((i = await info()).check_face_task_status !== 'done') await sleep(10000);
}
if (!i.video_has_face) throw new Error('No face found');
await fetch(`${url}/lipsync`, {
method: 'PUT', headers: h,
body: JSON.stringify({ is_multiple_speakers: true, is_free_lipsync: false }),
});
while (!['done', 'failed'].includes((i = await info()).lipsync_task_status)) {
console.log(i.lipsync_task_progress, i.tasks_in_lipsync_queue);
await sleep(15000);
}
console.log(i.lipsync_result_path);# 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. face check on the dubbed project - start it only if it has not run yet
curl -s https://api.rask.ai/v2/projects/$ID/lipsync -H "Authorization: Bearer $TOKEN" \
| jq '{check_face_task_status, video_has_face}'
curl -s -X PUT https://api.rask.ai/v2/projects/$ID/check_face -H "Authorization: Bearer $TOKEN"
# 3. run lip-sync (set is_free_lipsync to true for the free preview minute)
curl -s -X PUT https://api.rask.ai/v2/projects/$ID/lipsync \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{"is_multiple_speakers": true, "is_free_lipsync": false}'
# 4. follow progress, then download the result
curl -s https://api.rask.ai/v2/projects/$ID/lipsync -H "Authorization: Bearer $TOKEN" \
| jq '{lipsync_task_status, lipsync_task_progress, lipsync_result_path}'<?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']];
$info = fn() => $json($http->get("/v2/projects/$projectId/lipsync", ['headers' => $h]));
$i = $info();
if ($i['check_face_task_status'] !== 'done') {
$http->put("/v2/projects/$projectId/check_face", ['headers' => $h]);
while (($i = $info())['check_face_task_status'] !== 'done') sleep(10);
}
if (!$i['video_has_face']) exit('No face found');
$http->put("/v2/projects/$projectId/lipsync", ['headers' => $h,
'json' => ['is_multiple_speakers' => true, 'is_free_lipsync' => false]]);
while (!in_array(($i = $info())['lipsync_task_status'], ['done', 'failed'])) sleep(15);
echo $i['lipsync_result_path'];check face check_face_task_status done video_has_face true
queued lipsync_task_status started tasks_in_lipsync_queue 2
processing lipsync_task_progress 0 → 50 → 100
complete lipsync_task_status done
lipsync_result_path https://...

es-mx および es-es 同様に機能します。プロジェクトには glossary_versionが記録されるため、後から編集を行っても、完了した作業が勝手に変更されることはありません。はい。RaskのリップシンクAPIは、プロジェクトで吹き替えを行ったすべての動画でご利用いただけます。動画に顔が映っていることを確認し、リップシンクの処理を開始して、完了後にリップシンク済みの動画をダウンロードします。認証にはOAuth 2.0クライアントクレデンシャルを使用するため、APIの連携は他のRask APIと同じ手順で行えます。
リップシンクは翻訳された動画に対して実行されます。まずプロジェクトを作成して吹き替えを行い、プロジェクトに翻訳済み動画のリンクがあり、ステータスがmerging_doneになったらリップシンクを開始してください。
リップシンクでは、プロジェクトの吹き替え音声を使用します。ご自身の言葉を使用するには、翻訳されたテキストを編集するか、ご自身の.srtファイルから文字起こしを作成してプロジェクトの吹き替えをやり直し、新しいバージョンでリップシンクを実行してください。
Raskのリップシンクは、入力された動画内の実在する話者の実際の映像に対して行われます。画像やテキストプロンプトからのトーキングアバターの生成、デジタルヒューマン、AI動画生成は異なる製品カテゴリであり、それらの用途にはAI動画生成ツールの方が適しています。
話者の顔がはっきりと見え、照明が良好で、口元が遮られていない映像を使用してください。真横からのアングルや、マイク、手、字幕などで唇が隠れているものは避けてください。顔の検出機能によって顔の存在が確認されます。プレビューを使用して、映像での仕上がりをご確認ください。
リップシンク(口パク合わせ)は、動画を生成するたびに、ダビングとは別料金で請求されます。編集後に新しいリップシンク版を生成した場合も、再度リップシンクの料金が発生します。
はい。すべてのアカウントに、無料クレジットとして1分間のリップシンクが含まれています。「is_free_lipsync」を「true」に設定してタスクを実行すると、動画の1分間を同期して確認できます。クレジットのエンドポイントには「lipsync_free_minutes」として表示されます。
はい。インタビューやパネルディスカッションなど、画面に複数の人物が同時に映る可能性がある場合は、「is_multiple_speakers」を「true」に設定してください。常に1人だけが映る動画の場合は、処理を速くするために「false」に設定してください。
「GET /v2/projects/{id}/lipsync」を実行してください。レスポンスでは、「lipsync_task_status」が「started」から「done」または「failed」に変わり、「lipsync_task_progress」が0から100まで進みます。「tasks_in_lipsync_queue」には、あなたのタスクの前に何件待ちがあるかが表示されます。
処理時間は、動画の長さやリップシンクの混雑状況によって異なります。待ち順番や進捗率を利用して、ユーザーにタスクの現在の状況を正確に伝えることができます。
リップシンクはダビングされたバージョンごとに1回生成されます。テキスト、タイムスタンプ、スピーカー、音声を変更した後は、プロジェクトを再ダビングし、「merging_done」を待ってから再度リップシンクを実行してください。新しいリップシンクの生成は別料金となります。顔のチェックがすでに完了している場合は、再度実行する必要はありません。
「check_face_task_status」または「lipsync_task_status」が「failed」を示している場合は、project_idを添えて [email protected] までご連絡ください。チームで調査いたします。
APIへのアクセスは有料プランに含まれています。アプリ内でクライアントIDとシークレットを生成し、すぐに呼び出しを開始できます。企業向けの契約条件、大量利用の割引価格、カスタム言語の対応については、弊社チームまでお問い合わせください。