Dub into multiple languages

Add several target languages to a single project and download each dub.

How-to guide · Assumes you have created a dubbing project, as shown in the Dubbing quickstart.

A single project holds one source transcript, and you can add as many language targets as you need. Each language is generated independently and carries its own status and output, so you translate the source once and produce every dub from it.

Add several languages

Add one language target per language you want to dub into. Each starts in queued and begins generating once the project is ready.

1import os
2from dotenv import load_dotenv
3from elevenlabs.client import ElevenLabs
4
5load_dotenv()
6
7elevenlabs = ElevenLabs(api_key=os.getenv("ELEVENLABS_API_KEY"))
8
9project_id = "proj_1601kwkyxp0hfzvtmyxwqxx6mcy3"
10target_languages = ["es", "fr", "de", "ja"]
11
12languages = [
13 elevenlabs.dubbing.project.language.create(project_id, target_language=lang)
14 for lang in target_languages
15]

You can also queue the first language when you create the project by passing target_language to project.create. Add any further languages with language.create as shown above.

Track each language independently

Languages generate in parallel and finish at different times. List the project’s languages to check the status of each, rather than polling them one by one.

1import time
2
3while True:
4 result = elevenlabs.dubbing.project.language.list(project_id)
5 pending = [l for l in result.languages if l.status in ("queued", "processing")]
6 if not pending:
7 break
8 print(f"{len(pending)} language(s) still generating...")
9 time.sleep(5)

Download every completed dub

Once a language reaches completed, its outputs.lossless_audio holds a signed download URL. Download each one, skipping any language that failed.

1import requests
2
3result = elevenlabs.dubbing.project.language.list(project_id)
4for language in result.languages:
5 if language.status != "completed":
6 print(f"Skipping {language.target_language}: {language.status}")
7 continue
8 audio = requests.get(language.outputs.lossless_audio)
9 with open(f"dubbed_{language.target_language}.wav", "wb") as f:
10 f.write(audio.content)
11 print(f"Saved dubbed_{language.target_language}.wav")

Signed URLs expire about an hour after they are issued. If a download fails because the URL has expired, fetch the language again with language.get to obtain a fresh URL.