Overview
Translate the audio of any video into another language while preserving the original speaker’s voice characteristics. Dubbing is useful for content localization, accessibility, and reaching global audiences without re-recording. The dubbing pipeline is asynchronous: you submit a job, poll until it completes, then retrieve the dubbed output.Prerequisites
1
Create an account
Sign up at CAMB.AI Studio if you haven’t already.
2
Get your API key
Go to Settings → API Keys in Studio and copy your key. See Authentication for details.
3
Install the SDK
4
Set your API key to use in your code
Code
Use Your Own SRT Transcript or Translation (Python)
Supply an original-language transcript withsource_transcript, translated
dialogue with target_transcripts, or both. Read local .srt files as UTF-8 and
send their contents, not paths, URLs, base64 strings, or segment arrays.
This example requires a Python SDK release containing
DubSRTInput and
DubTargetSRTInput (SDK change)
and an API deployment supporting custom SRT input. If these imports are unavailable,
check the SDK release before running this example. The example below is Python-only;
it does not assume matching TypeScript SDK support.CAMB_API_KEY and replace the video URL with your publicly accessible media.
This example submits both files, polls for up to ten minutes, and retrieves the result:
Python
- For a custom transcript only, omit
target_transcripts; translations are generated automatically. - For custom translations only, omit
source_transcript. Include it when available to provide source-language context. - For multiple translations, add one
DubTargetSRTInputper language and include each language intarget_languages, usingLanguagesenums throughout. Targets without a supplied translation use automatic translation. - Omit both fields to retain the automatic dubbing workflow. The same input arguments work with
AsyncCambAI.
format defaults to "srt". The API validates SRT parsing and requires at least
one cue, with limits of 2 MiB UTF-8 per script, 10 MiB combined, and 100 target
scripts. Target languages must be unique and included in target_languages.
Overlapping and out-of-order cues are allowed. API validation failures raise
UnprocessableEntityError (HTTP 422); exc.body.detail identifies the invalid fields.
See the dubbing API reference for the request contract.
Parameters
Required
Optional
Language Enum
Use theLanguages enum (Python) or CambApi.Languages (TypeScript) to specify languages:
Tips
- Video URL: The URL must be publicly accessible. YouTube video links and direct file URLs (MP4, WebM) are both supported.
- Polling timeout: For long videos, cap your polling loop (e.g. 60 attempts × 5s = 5 minutes) and handle the timeout gracefully.
- Multiple targets:
target_languagesaccepts an array — pass several languages to dub into all of them in a single job, which is more efficient than submitting separate jobs. - Transcripts: The result object includes a
transcriptfield with per-segment timing data, useful for subtitle generation.
Next Steps
End-to-End Dubbing API
Full API reference for the dubbing endpoint.
Get Dubbing Status
Status polling endpoint reference.
Get Dubbed Run Info
Retrieve the dubbed output URLs and transcript.
Voice Cloning
Clone a custom voice for use in speech generation.