# 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



قم برفع الفيديو أو أرسل رابطاً عاماً، وأنشئ مشروعاً بلغة مستهدفة وانتظر حتى تكتمل عملية الدمج. تحتاج مزامنمة حركة الشفاه إلى الفيديو المترجم الخاص بهذا المشروع.
تؤكد مهمة التحقق من الوجه وجود وجه واحد على الأقل في الفيديو. تبدأ عادةً تلقائياً. وإذا لم تبدأ، قم بتشغيلها بنفسك مرة واحدة للمشروع.
قم بتشغيل مهمة مزامنة الشفاه، وتابع تقدمها من 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 على أي فيديو تمت دبلجته في مشروعك. تأكد من أن الفيديو يحتوي على وجه، وابدأ مهمة مزامنة الشفاه، ثم قم بتنزيل الفيديو المتطابق عندما تنتهي المهمة. تستخدم المصادقة بيانات اعتماد عميل OAuth 2.0، لذا فإن تكامل واجهة برمجة التطبيقات يتبع نفس النمط مثل باقي واجهات برمجة التطبيقات الخاصة بـ Rask.
تعمل مزامنة الشفاه على فيديو مترجم. أنشئ مشروعك ودبلجه أولاً، وابدأ مزامنة الشفاه عندما يحتوي المشروع على رابط فيديو مترجم وحالة اكتمال الدمج.
تستخدم مزامنة الشفاه الصوت المدبلج للمشروع. لاستخدام صياغتك الخاصة، قم بتعديل النص المترجم أو أنشئ النص المكتوب من ملف srt الخاص بك، وأعد دبلجة المشروع، ثم قم بتشغيل مزامنة الشفاه على الإصدار الجديد.
تقوم Rask بمزامنة الشفاه لمقاطع الفيديو الحقيقية لمتحدثين حقيقيين في الفيديو الخاص بك. يُعد إنشاء الصور الرمزية المتحدثة، والبشر الرقميين، وإنشاء فيديوهات بالذكاء الاصطناعي من صورة أو نص فئة منتج مختلفة، وتعتبر أداة إنشاء الفيديوهات بالذكاء الاصطناعي الخيار الأنسب لها.
استخدم لقطات يكون فيها وجه المتحدث واضحاً وإضاءة جيدة وفماً غير محجوب. تجنب اللقطات الجانبية القوية وأي شيء يغطي الشفاه مثل الميكروفون أو اليد أو الترجمة. يؤكد فحص الوجه وجود وجه، واستخدم معاينة النتائج على اللقطات الخاصة بك.
تتم فوترة مزامنة الشفاه بشكل منفصل عن الدبلجة لكل عملية إنشاء فيديو بالكامل. يؤدي إنشاء إصدار جديد بمزامنة الشفاه بعد التعديلات إلى رسوم إضافية لمزامنة الشفاه.
نعم. يتضمن كل حساب دقيقة واحدة مجانية لمزامنة الشفاه ضمن رصيدك المجاني. قم بتشغيل المهمة مع جعل is_free_lipsync مضبوطاً على صحيح لمزامنة دقيقة واحدة من الفيديو الخاص بك ومراجعتها. تظهر نقطة النهاية للرصيد ذلك تحت اسم lipsync_free_minutes.
نعم. اجعل is_multiple_speakers مضبوطاً على صحيح عندما يظهر أكثر من وجه على الشاشة في نفس الوقت، كما هو الحال في المقابلات أو الحوارات الجماعية. أما إذا كان الفيديو يعرض وجهاً واحداً فقط في كل مرة، فاضبطه على خطأ لزيادة سرعة المعالجة.
قم باستدعاء GET /v2/projects/{id}/lipsync. في الاستجابة، تنتقل حالة lipsync_task_status من "بدأت" إلى "تمت" أو "فشلت"، وينتقل تقدم lipsync_task_progress من 0 إلى 100، بينما توضح tasks_in_lipsync_queue عدد المهام التي تسبق مهمتك.
تختلف مدة المعالجة بناءً على طول الفيديو وقائمة انتظار مزامنة الشفاه. يتيح لك موقعك في قائمة الانتظار وقيمة التقدم إطلاع المستخدمين على حالة المهمة بدقة.
يتم إنشاء مزامنة الشفاه مرة واحدة لكل نسخة مدبلجة. بعد تعديل النص أو الطوابع الزمنية أو المتحدثين أو الأصوات، قم بإعادة دبلجة المشروع، وانتظر حتى تنتهي عملية الدمج merging_done، ثم شغل مزامنة الشفاه مرة أخرى. يتم احتساب رسوم إنشاء مزامنة الشفاه الجديدة بشكل منفصل، بينما لا تحتاج عملية فحص الوجه المكتملة إلى إعادة التشغيل.
إذا أظهرت حالة check_face_task_status أو lipsync_task_status فشلاً، يرجى التواصل عبر البريد الإلكتروني [email protected] مع ذكر معرف المشروع project_id وسيقوم الفريق بمراجعة المشكلة.
تم تضمين صلاحية استخدام واجهة برمجة التطبيقات مع الباقات المدفوعة. يمكنك إنشاء معرف العميل الخاص بك وكلمة السر في التطبيق والبدء في استخدام الخدمة فوراً. بالنسبة لشركات الأعمال، أسعار الكميات، وتغطية اللغات المخصصة، فيتم ترتيبها عبر فريقنا.