Translate (dub) the spoken audio of a video into another language using the Mux Robots API.
Translate the spoken audio of a Mux asset into another language and automatically attach the result as a new audio track, so viewers can switch languages from the player's audio menu. Where translate captions produces a text track in another language, translate-audio produces a dubbed audio track. See the Translate Audio API referenceAPI for the full endpoint specification. See Mux Robots pricing for unit costs.
Experimental
The translate-audio workflow is experimental. The API shape, parameters, behavior, and pricing may change. If we make changes to this workflow while you're using it, we'll let you know via email.
Audio translation requires an asset with an audio track. A translate-audio job is rejected if the asset has no audio, or if an audio track for the target language already exists.
translate-audio jobcurl https://api.mux.com/robots/v0/jobs/translate-audio \
-H "Content-Type: application/json" \
-X POST \
-d '{
"parameters": {
"asset_id": "YOUR_ASSET_ID",
"to_language_code": "es"
}
}' \
-u ${MUX_TOKEN_ID}:${MUX_TOKEN_SECRET}This request is asynchronous. The POST returns immediately with the job in pending status and does not include results. We strongly recommend listening for the robots.job.translate_audio.completed webhook: the payload contains the full completed job, so no follow-up API call is needed. If webhooks aren't an option, you can poll GET /robots/v0/jobs/translate-audio/{JOB_ID} with the id from the response until the status is completed.
| Parameter | Type | Description |
|---|---|---|
asset_id | string | Required. The Mux asset ID whose audio will be translated. |
to_language_code | string | Required. BCP 47 target language code (e.g. es, fr, ja). |
upload_to_mux | boolean | Whether to upload the dubbed audio and attach it as a new audio track on the asset. Defaults to true. |
The outputs object is included in the job once its status is completed. You'll receive it on the robots.job.translate_audio.completed webhook (recommended), or you can fetch it with GET /robots/v0/jobs/translate-audio/{JOB_ID}. It contains:
| Field | Type | Description |
|---|---|---|
uploaded_track_id | string | Mux audio track ID of the uploaded dubbed track. Present when upload_to_mux is true. |
temporary_audio_url | string | Temporary pre-signed URL to download the dubbed audio file. Expires 7 days after the job completes. |
This is the payload delivered to the robots.job.translate_audio.completed webhook, and the same shape you get from GET /robots/v0/jobs/translate-audio/{JOB_ID}:
{
"data": {
"id": "rjob_vwx234",
"workflow": "translate-audio",
"status": "completed",
"units_consumed": 4500,
"parameters": {
"asset_id": "YOUR_ASSET_ID",
"to_language_code": "es",
"upload_to_mux": true
},
"outputs": {
"uploaded_track_id": "track_es_abc123",
"temporary_audio_url": "https://storage.googleapis.com/..."
}
}
}When upload_to_mux is true (the default), the dubbed audio is attached to your asset as a new audio track. Viewers can select the new language from the player's audio menu. See add alternate audio tracks for more on multi-language audio.