-
Getting Started
-
Video Translation
-
AI Avatar
-
AI Voiceover
-
AI Transcription
Create task
Updated2024 年 5 月 20 日
POST
Parameters
Header parameters
Name | Description |
---|---|
dupdub_token | Your DupDub token |
Content-Type | application/json |
Body parameters
Name | Type | Description |
---|---|---|
videoUrl | string | required | URL of the video to be translated |
sourceLanguage | string | required | The source language: Afrikaans Arabic Armenian Azerbaijani Belarusian Bosnian Bulgarian Catalan Chinese Croatian Czech Danish Dutch English Estonian Finnish French Galician German Greek Hebrew Hindi Hungarian Icelandic Indonesian Italian Japanese Kannada Kazakh Korean Latvian Lithuanian Macedonian Malay Marathi Maori Nepali Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Tagalog Tamil Thai Turkish Ukrainian Urdu Vietnamese Welsh |
targetLanguage | string | required | The target language: English Japanese Chinese German Hindi French Korean Portuguese Italian Spanish Indonesian Dutch Turkish Filipino Polish Swedish Bulgarian Romanian Arabic Czech Greek Finnish Croatian Malay Slovak Danish Tamil Ukrainian Russian |
speakerNum | integer | required | -1: auto 1 ~ 8 |
title | string | optional | The title of the translation project |
lipSync | integer | optional | Specifies if lip synchronization is required 1: Yes 2: No (default) |
musicStatus | integer | optional | Specified if preserve background music 1: Yes 2: No (default) |
captionsType | integer | optional | Specified if add subtitle 1: Yes 2: No (default) |
subtitleType | integer | optional | Specified whether to use the original text, the translation text, or both for the subtitles. This setting is applicable only when captionType is set to 1 1: Translation 2: Original 3: Both |
transText | integer | optional | Remove captions from the source video: 1: Yes 2: No (default) |
Response
Name | Type | Description |
---|---|---|
data | object | The container object for the response data |
├ id | integer | Unique identifier of the project |
├ source | string | Source URL of the video |
├ userId | integer | User identifier associated with the project |
├ title | string | Title of the project |
├ taskId | string | Task identifier for the project |
├ videoUrl | string | URL of the translated video |
├ duration | integer | Duration of the video in seconds |
├ spaceSize | integer | The size of the video file in bytes |
├ width | integer | Width of the video |
├ height | integer | Height of the video |
├ executeStatus | integer | Execution status of the translation process 1: Processing 2: Succeed 3: Failed |
├ executeMsg | string | Execution message or error message if any |
├ status | integer | Current status of the project 0: Failed 1: Succeed |
├ sourceLanguage | string | Source language of the video |
├ targetLanguage | string | Target language of the translation |
├ transText | integer | Subtitle removal status |
├ lipSync | integer | Lip sync status |
├ speakerNum | integer | Number of speakers in the translated video |
├ retVideoUrl | string | URL of the resulting translated video |
├ coverPhotoUrl | string | URL of the cover photo for the video |
├ lastopenAt | string | Last access time |
├ createdAt | string | Creation date and time of the project |
├ updatedAt | string | Last update date and time of the project |
├ statusPercentage | integer | Percentage completion of the project |
├ statusPercentageName | string | Name description of the completion percentage |
├ watchStatus | integer | Watching status of the project 0: No 1: Yes |
├ withoutVideo | integer | Status of final video synthesis 1: No synthesized 2: Synthesized |
code | integer | Response code indicating success or failure 200: Succeed 400: Parameter validation failed 403: No relevant permissions 500: Failed 502: Gateway service exception 2001: Login failed, please login again 2060: You do not have enough remaining credits or an active subscription. Upgrade your plan to access more 3000: Server error, please try again later 3018: Server error, please try again later 4082: Failed to parse the video 4083: Your account doesn’t have enough credits. Upgrade to create this video 4084: The video duration is too short, please try another one |
message | string | A message providing additional information about the response code |
Sample Codes
Request
import requests
# API endpoint for creating a video translation project
url = "https://moyin-gateway.dupdub.com/tts/v1/videoTrans/create"
# Your DupDub API key
api_key = "<<Your DupDub API Key>>"
# Project details
data = {
"videoUrl": "https://cdn-static.dupdub.com/backend/subtitles/2024-03-08-9220709806353611459.mp4",
"sourceLanguage": "English",
"targetLanguage": "German",
"title": "Did Mona Lisa Find The Pearl Earring?",
"speakerNum": -1
}
headers = {
"dupdub_token": f"{api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, json=data, headers=headers)
# Parse the response
if response.status_code == 200:
result = response.json()
print(result)
task_id = result["data"]["taskId"]
print("Project created successfully. Task ID:", task_id)
else:
print("Failed to create project. Status Code:", response.status_code)
Response
{
'code': 200,
'message': 'OK',
'data': {
'id': 2649,
'source': 'web',
'userId': 131361,
'title': 'Did Mona Lisa Find The Pearl Earring?',
'taskId': '5fa12a2571ef49d79c0109edb10ac9ba',
'videoUrl': 'https://cdn-static.dupdub.com/backend/subtitles/2024-03-08-9220709806353611459.mp4',
'duration': 40,
'spaceSize': None,
'width': 270,
'height': 480,
'executeStatus': 1,
'executeMsg': None,
'status': 1,
'sourceLanguage': 'English',
'targetLanguage': 'German',
'transText': 2,
'lipSync': 2,
'speakerNum': -1,
'retVideoUrl': None,
'coverPhotoUrl': 'https://cdn-static.dupdub.com/backend/subtitles/bbb89ca117c04df59381378ff0b99722.png',
'lastopenAt': '2024-03-09 14:43:04',
'createdAt': '2024-03-09 14:43:04',
'updatedAt': '2024-03-09 14:43:04',
'statusPercentage': None,
'watchStatus': None,
'statusPercentageName': None,
'withoutVideo': 2
}
}
Table of Contents