# 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 สาธารณะ สร้างโปรเจกต์ด้วยภาษาเป้าหมาย และรอจนกว่า merging_done จะเสร็จสิ้น การซิงค์ริมฝีปากจำเป็นต้องใช้ translated_video ของโปรเจกต์นี้
งานตรวจสอบใบหน้าจะยืนยันว่ามีใบหน้าอย่างน้อยหนึ่งใบหน้าในวิดีโอ โดยปกติจะเริ่มทำงานโดยอัตโนมัติ หากยังไม่เริ่ม ให้เรียกใช้งานด้วยตนเองหนึ่งครั้งสำหรับโปรเจกต์
เรียกใช้งานการซิงค์ริมฝีปาก ติดตาม lipsync_task_progress จาก 0 ถึง 100 จากนั้นดาวน์โหลดวิดีโอจาก lipsync_result_path
# 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เพื่อให้การแก้ไขภายหลังไม่ไปกระทบงานที่เสร็จสมบูรณ์แล้วโดยไม่รู้ตัวมีค่ะ API ซิงค์ริมฝีปากของ Rask สามารถใช้งานได้กับวิดีโอทุกเรื่องในโปรเจกต์ที่คุณพากย์เสียงแล้ว เพียงตรวจสอบว่าวิดีโอนั้นมีใบหน้า เริ่มต้นงานซิงค์ริมฝีปาก แล้วดาวน์โหลดวิดีโอที่ซิงค์ริมฝีปากแล้วเมื่อเสร็จสิ้น ระบบยืนยันตัวตนใช้ OAuth 2.0 client credentials ดังนั้นการเชื่อมต่อ API จึงใช้รูปแบบเดียวกับส่วนอื่นๆ ของ Rask API
การซิงค์ริมฝีปากจะทำงานบนวิดีโอที่แปลแล้ว ให้สร้างและพากย์เสียงโปรเจกต์ของคุณก่อน จากนั้นจึงเริ่มซิงค์ริมฝีปากเมื่อโปรเจกต์มีลิงก์ translated_video และสถานะเป็น merging_done
การซิงค์ริมฝีปากจะใช้เสียงพากย์ของโปรเจกต์ หากต้องการใช้คำพูดของคุณเอง ให้แก้ไขข้อความที่แปลแล้วหรือสร้างบทพูดจากไฟล์ .srt ของคุณเอง จากนั้นพากย์เสียงโปรเจกต์ใหม่อีกครั้ง แล้วค่อยรันการซิงค์ริมฝีปากบนเวอร์ชันใหม่นั้น
Rask ทำการซิงค์ริมฝีปากจากฟุตเทจจริงของบุคคลจริงในวิดีโอที่คุณอัปโหลด การสร้างอวตารพูดได้ มนุษย์ดิจิทัล และการสร้างวิดีโอ AI จากรูปภาพหรือข้อความพร้อมท์จัดอยู่ในหมวดหมู่ผลิตภัณฑ์ที่แตกต่างกัน ซึ่งเครื่องมือสร้างวิดีโอ AI จะตอบโจทย์ในส่วนนี้มากกว่า
ควรใช้ฟุตเทจที่มองเห็นใบหน้าที่กำลังพูดได้อย่างชัดเจน มีแสงสว่างเพียงพอ และไม่มีสิ่งกีดขวางบริเวณปาก หลีกเลี่ยงมุมข้างที่เห็นใบหน้าไม่ชัดเจนและสิ่งใดก็ตามที่บังริมฝีปาก เช่น ไมโครโฟน มือ หรือคำบรรยาย ระบบตรวจสอบใบหน้าจะยืนยันว่ามีใบหน้าอยู่ในวิดีโอหรือไม่ ให้ใช้ตัวอย่างก่อนพิมพ์เพื่อประเมินผลลัพธ์บนฟุตเทจของคุณ
การซิงค์ริมฝีปากจะเรียกเก็บเงินแยกต่างหากจากการพากย์เสียงสำหรับการสร้างวิดีโอเต็มรูปแบบแต่ละครั้ง การสร้างเวอร์ชันซิงค์ริมฝีปากใหม่หลังจากมีการแก้ไข จะมีค่าใช้จ่ายในการซิงค์ริมฝีปากเพิ่มเติม
มีค่ะ ทุกบัญชีจะได้รับสิทธิ์ทดลองใช้การซิงค์ริมฝีปากฟรี 1 นาทีจากเครดิตฟรีของคุณ คุณสามารถรันงานโดยตั้งค่า is_free_lipsync เป็น true เพื่อซิงค์วิดีโอความยาวหนึ่งนาทีและตรวจสอบดูได้ ส่วนพอยต์เครดิตจะแสดงรายการนี้ว่าเป็น lipsync_free_minutes
ได้ค่ะ ให้ตั้งค่า is_multiple_speakers เป็น true เมื่อมีใบหน้ามากกว่าหนึ่งคนปรากฏบนหน้าจอพร้อมกัน เช่น ในวิดีโอสัมภาษณ์หรือการเสวนา แต่ถ้าในวิดีโอมีผู้พูดทีละคน ให้ตั้งค่าเป็น 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) โปรดติดต่อ [email protected] พร้อมแจ้ง project_id ของคุณเพื่อให้ทีมงานตรวจสอบให้ค่ะ
สิทธิ์การใช้งาน API รวมอยู่ในแพ็กเกจแบบชำระเงินแล้ว คุณสามารถสร้างรหัสลูกค้าและรหัสลับในแอปเพื่อเริ่มเรียกใช้งานได้ทันที สำหรับเงื่อนไขระดับองค์กร, ราคาตามปริมาณการใช้งาน และภาษาเฉพาะทาง โปรดติดต่อทีมงานของเรา