TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/phpaisdk/elevenlabs/llms.txt
Use this file to discover all available pages before exploring further.
Dubbing resource translates and re-voices video or audio content into a target language using ElevenLabs’ dubbing pipeline. Because dubbing involves speech detection, translation, and synthesis, the process is asynchronous: you create a job, poll until it finishes, and then retrieve the dubbed media or subtitle transcript. The three phases are described below.
Dubbing is an asynchronous operation. Depending on media length and server load, a job may complete in a few seconds or several minutes. Poll
status() on a schedule — such as every five seconds — rather than assuming immediate completion.Call
create() to submit the media for dubbing. It returns a DubbingJob with the job ID and an estimated duration.$job = ElevenLabs::dubbing()->create(
Content::video(__DIR__.'/interview.mp4'),
targetLanguage: 'es',
options: ['source_lang' => 'en'],
);
echo $job->id; // e.g. "dub-abc123"
echo $job->expectedDuration; // estimated duration in seconds
$job = ElevenLabs::dubbing()->create(
Content::video('https://example.com/interview.mp4'),
targetLanguage: 'fr',
);
Call
status() with the job ID to check progress. The status field reflects the current state of the job.$status = ElevenLabs::dubbing()->status($job->id);
echo $status->status; // 'pending', 'dubbing', 'dubbed', or 'failed'
If dubbing fails,
$status->status will be 'failed' and $status->error will contain a message from ElevenLabs describing the reason. Always check for 'failed' before attempting to retrieve output.if ($status->status === 'dubbed') {
ElevenLabs::dubbing()
->output($job->id, 'es')
->save(__DIR__.'/interview-es.mp4');
}
Subtitle transcript —
transcript() returns a DubbingTranscript. Use 'srt' or 'vtt' for caption files, or 'json' for structured data:Method Reference
create()
Submits a new dubbing job and returns a DubbingJob.
The source media to dub. Use
Content::video() for video files or URLs, or Content::audio() for audio-only content.- If
$mediahas a URL (created from a URL string), the URL is sent as asource_urlstring form field. - Otherwise the raw binary is uploaded as a
filemultipart part with filenamesource.binand content typeapplication/octet-stream.
The BCP-47 language code for the target dubbed language. For example
'es' for Spanish or 'fr' for French. Sent as the target_lang multipart form field.Additional ElevenLabs dubbing parameters passed as multipart form fields. Common options include:
source_lang(string) — BCP-47 code of the source language. Omit to let ElevenLabs auto-detect.num_speakers(int) — Hint for the number of distinct speakers in the source.watermark(bool) — Whether to apply an ElevenLabs watermark to the output.
Content instance is added as a file upload part; all other values are sent as string parts.status()
Fetches the current state of a dubbing job.
The job ID returned by
create() as $job->id.output()
Downloads the dubbed media for a completed job. Returns a BinaryData instance.
The job ID of the completed dubbing job.
The BCP-47 language code of the dubbed track to retrieve. Must match one of the
targetLanguages on the job.transcript()
Downloads a subtitle or structured transcript for a completed job. Returns a DubbingTranscript.
The job ID of the completed dubbing job.
The BCP-47 language code of the transcript to retrieve.
Transcript format. One of
'srt', 'vtt', or 'json'.Return Types
DubbingJob
Returned by create().
The unique ID of the dubbing job, populated from the
dubbing_id field in the API response. Store this to poll status and retrieve output.ElevenLabs’ estimate of the time required to complete the job, in seconds. Populated from the
expected_duration_sec field in the API response.The full decoded JSON response from the ElevenLabs API for inspection or debugging.
DubbingStatus
Returned by status().
The dubbing job ID.
A human-readable name for the dubbing job.
Current job state. One of
'pending', 'dubbing', 'dubbed', or 'failed'.The detected or declared source language of the media.
The list of BCP-47 language codes the media is being or has been dubbed into.
ISO 8601 timestamp of when the job was created.
Whether the dub is editable in ElevenLabs Dubbing Studio.
MIME type of the source media, e.g.
'video/mp4' or 'audio/mpeg'.Duration of the source media in seconds, as reported by ElevenLabs.
An error message from ElevenLabs if
status is 'failed'. null otherwise.The full decoded JSON response from the ElevenLabs API for inspection or debugging.
DubbingTranscript
Returned by transcript().
The format of this transcript as confirmed by ElevenLabs:
'srt', 'vtt', or 'json'.The raw transcript text for
'srt' or 'vtt' formats. null when the format is 'json'.Parsed transcript data when the
json key is present in the API response. null when the format is 'srt' or 'vtt'.The full decoded JSON response from the ElevenLabs API for inspection or debugging.
