# 1. import the video - YouTube, Drive, Vimeo or a direct URL
curl -X POST https://api.rask.ai/v3/media/import \
-H "Authorization: Bearer $RASK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://youtu.be/..."}'
# 2. the price first - free, and it changes nothing
curl -X POST https://api.rask.ai/v3/projects/estimate \
-H "Authorization: Bearer $RASK_API_KEY" \
-H "Content-Type: application/json" \
-d '{"media_id": "...", "target_language": "es-mx"}'
# 3. dub with the speakers' own voices - the price you accepted is the ceiling
curl -X POST https://api.rask.ai/v3/projects \
-H "Authorization: Bearer $RASK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"media_id": "...",
"target_language": "es-mx",
"expected_cost_minutes": 12
}'# Wait on the job instead of polling: one request, up to 20 seconds.
curl -s "https://api.rask.ai/v3/jobs/$JOB_ID?wait_seconds=20" \
-H "Authorization: Bearer $RASK_API_KEY" | jq .status以多部分表单数据形式发送文件,或发布来自YouTube、Google Drive、S3、Vimeo或任何直接URL的链接。此视频中的语音将作为每个即时声音克隆的语音样本。
传入 media_id 和目标语言。每个检测到的说话人都会在支持的语言中获得一个即时声音克隆,配音将立即开始。
列出项目的声音,为任意发言人分配自定义克隆或预设,然后调用 /generate,并在配音完成后下载文件。
# pip install rask-sdk
from rask_sdk import Rask
rask = Rask() # reads RASK_API_KEY
uploaded = rask.jobs.wait(rask.uploads.upload_file("keynote.mp4").id)
media_id = uploaded.result.media_id
# the price first - free, and it changes nothing
estimate = rask.projects.estimate_project(
media_id=media_id, target_language="es-mx"
)
# the price you accepted is the ceiling
created = rask.projects.create_project(
media_id=media_id,
target_language="es-mx",
expected_cost_minutes=estimate.total_minutes,
)
processed = rask.jobs.wait(created.id)
outputs = rask.exports.list_project_outputs(processed.result.project_id).data
print(next(o.url for o in outputs if o.kind == "dubbed_video"))import os, requests
API = "https://api.rask.ai/v3"
h = {"Authorization": f"Bearer {os.environ['RASK_API_KEY']}"}
job = requests.post(f"{API}/media/import", headers=h,
json={"url": "https://youtu.be/..."}).json()
media_id = requests.get(f"{API}/jobs/{job['id']}?wait_seconds=20",
headers=h).json()["result"]["media_id"]
order = {"media_id": media_id, "target_language": "es-mx"}
# the price first - free, and it changes nothing
estimate = requests.post(f"{API}/projects/estimate", headers=h, json=order).json()
# the price you accepted is the ceiling
project = requests.post(f"{API}/projects", headers=h,
json={**order,
"expected_cost_minutes": estimate["total_minutes"]}).json()
outputs = requests.get(f"{API}/projects/{project['project_id']}/outputs",
headers=h).json()
print(next(o["url"] for o in outputs["data"] if o["kind"] == "dubbed_video"))// no dependencies, Node 18+ global fetch
const API = 'https://api.rask.ai/v3';
const h = {
Authorization: `Bearer ${process.env.RASK_API_KEY}`,
'Content-Type': 'application/json',
};
const imported = await fetch(`${API}/media/import`, {
method: 'POST', headers: h,
body: JSON.stringify({ url: 'https://youtu.be/...' }),
}).then(r => r.json());
const job = await fetch(`${API}/jobs/${imported.id}?wait_seconds=20`, { headers: h })
.then(r => r.json());
const order = { media_id: job.result.media_id, target_language: 'es-mx' };
// the price first - free, and it changes nothing
const estimate = await fetch(`${API}/projects/estimate`, {
method: 'POST', headers: h, body: JSON.stringify(order),
}).then(r => r.json());
// the price you accepted is the ceiling
const project = await fetch(`${API}/projects`, {
method: 'POST', headers: h,
body: JSON.stringify({ ...order, expected_cost_minutes: estimate.total_minutes }),
}).then(r => r.json());
const outputs = await fetch(`${API}/projects/${project.project_id}/outputs`, { headers: h })
.then(r => r.json());
console.log(outputs.data.find(o => o.kind === 'dubbed_video')?.url);API=https://api.rask.ai/v3
AUTH="Authorization: Bearer $RASK_API_KEY"
JSON="Content-Type: application/json"
# 1. import the video, then wait for the media id
JOB=$(curl -s -X POST $API/media/import -H "$AUTH" -H "$JSON" \
-d '{"url": "https://youtu.be/..."}' | jq -r .id)
MEDIA=$(curl -s "$API/jobs/$JOB?wait_seconds=20" -H "$AUTH" | jq -r .result.media_id)
ORDER="{\"media_id\":\"$MEDIA\",\"target_language\":\"es-mx\"}"
# 2. the price first - free, and it changes nothing
CAP=$(curl -s -X POST $API/projects/estimate -H "$AUTH" -H "$JSON" \
-d "$ORDER" | jq -r .total_minutes)
# 3. the price you accepted is the ceiling
ID=$(curl -s -X POST $API/projects -H "$AUTH" -H "$JSON" \
-d "$(jq -c --argjson cap "$CAP" '. + {expected_cost_minutes:$cap}' <<<"$ORDER")" \
| jq -r .project_id)
# 4. collect the dubbed video, in the speakers' own voices
curl -s $API/projects/$ID/outputs -H "$AUTH" \
| jq -r '.data[] | select(.kind == "dubbed_video") | .url'<?php
use GuzzleHttp\Client;
$http = new Client([
'base_uri' => 'https://api.rask.ai/v3/',
'headers' => ['Authorization' => 'Bearer ' . getenv('RASK_API_KEY')],
]);
$job = json_decode($http->post('media/import',
['json' => ['url' => 'https://youtu.be/...']])->getBody(), true);
$media = json_decode($http->get("jobs/{$job['id']}?wait_seconds=20")->getBody(), true);
$order = ['media_id' => $media['result']['media_id'], 'target_language' => 'es-mx'];
// the price first - free, and it changes nothing
$estimate = json_decode($http->post('projects/estimate',
['json' => $order])->getBody(), true);
// the price you accepted is the ceiling
$project = json_decode($http->post('projects', ['json' => $order + [
'expected_cost_minutes' => $estimate['total_minutes'],
]])->getBody(), true);
$outputs = json_decode(
$http->get("projects/{$project['project_id']}/outputs")->getBody(), true); 0s queued
3s running transcribing
48s running translating
72s running voicing
128s running merging
150s succeeded

es-mx 和 es-es 类似项目。项目记录 glossary.version,因此后续的修改绝不会悄悄改变已完成的工作。是的。Rask 声音克隆 API 在为视频配音时会克隆每位说话人的声音。创建一个包含目标语言的项目,每位说话人即可在支持的语言中获得即时声音克隆。您还可以将您在 Rask 应用中创建的定制声音克隆分配给任意说话人。
即时声音克隆在支持的目标语言中直接使用源视频中的说话人声音。若需可重复使用的定制声音克隆,请在征得说话人同意的前提下在 Rask 应用中创建,然后通过 API 进行分配。效果取决于源音频以及所选的语言和声音。
即时声音克隆根据您配音的视频中的语音自动生成,无需录制短音频样本。定制声音克隆则通过您上传一次的音频样本进行训练,并保存在您的语音库中,可通过 voice_id 在任何项目中重复使用。在语音列表中,即时声音克隆带有“Voice Clone”标签,性别显示为“auto”。
您可以在 Rask 网页平台上创建定制声音克隆。保存克隆后,通过获取项目语音(get project voices)端点检索其 voice_id,并通过 API 将其分配给说话人。
请上传1到10分钟的音频或视频(最多10个文件,每个文件最大10 MB,支持MP4、MOV、WEBM、MKV、MP3、M4A或WAV格式),或者粘贴YouTube或Google Drive链接。为了获得最佳效果,请使用单人说话、说话风格保持一致的录音,并在安静的房间内用优质麦克风录制,无背景噪声。
语音克隆支持57种基础语言及其支持的地区变体。地区变体使用的是基础克隆模型:例如,英式英语文本会使用美式英语的语音模型。对于其他目标语言,请选择预设的人工智能语音。查看API语言目录了解完整列表。
该API可为视频和音频录音(包括纯音频播客和访谈)进行配音。要使用您自己的措辞,请逐段编辑翻译好的文本,或在创建项目前使用您自己的.srt文件创建文字记录,这样克隆的声音就会说出您的文本。输入内容始终是录音,因此对于纯文本配音,文字转语音API会是更好的选择。
Read the speakers with GET /v3/projects/{project_id}/speakers, then assign a voice to one of them with PUT /v3/projects/{project_id}/speakers/{speaker_id}/voice and re-dub with POST /v3/projects/{project_id}/dub. Estimate the re-dub first and the price comes back before anything runs: it is billed on the combined duration of changed segments, with a one-minute minimum per charged run.
创作者专业版(Creator Pro)套餐包含最多3个自定义声音,商业版包含最多10个共享团队声音,企业版则提供自定义声音库。
是的。自定义声音克隆是在征得说话者同意的情况下创建的,您只能为说话者已同意的视频配音。Rask采用基于同意的声音克隆和人工智能安全控制,您的音频绝不会用于训练通用模型。
克隆会复制说话者的声音特征,包括音色和音高,让他们在说另一种语言时听起来依然像他们自己。情感基调、语速和节奏则遵循源音频和翻译后的脚本,因此清晰、富有表现力的源语音能带来最佳效果。
当您拥有源视频的版权并获得说话者的同意时,您可以在商业内容中发布带有克隆声音的配音视频。有关适用于您套餐的详细信息,请查看Rask服务条款。
声音克隆是配音的一部分,不收取单独费用:API使用费按视频分钟数计费(向上取整到下一个完整分钟),并从Rask应用相同的分钟数额度中扣除。超出套餐的分钟数按每分钟3美元收费。更改声音后的重新配音仅对更改的片段计费。您可以免费试用,无需信用卡。