Translation/Dubbing
Translation/Dubbing
Translation/Dubbing
If you only need standard language translation with lipsync, the single-call dubParams flow is simpler — see the Dubbing guide. This tutorial is for users who want fine-grained control over orchestration across ElevenLabs, OpenAI, and Sync Labs.
Video translation and dubbing allows you to convert your content into different languages while maintaining natural lip movements and voice quality. This tutorial will show you how to translate and dub videos programmatically, making your content accessible to global audiences.
Follow these steps to run the translation/dubbing example:
Modify the args.py file to configure the following inputs and settings:
SYNCLABS_API_KEY: Your API key for Sync LabsELEVENLABS_API_KEY: Your API key for ElevenLabsOPENAI_API_KEY: Your API key for OpenAIRequired settings:
input_vid_url: URL of the video to be translated/dubbed.target_language: Target language for translation (e.g., “Spanish”)output_json_path: File path for saving output JSON dataOptional settings:
source_language: Source language of the video (leave blank for auto-detection)voice_id: ElevenLabs voice ID (leave blank to automatically clone voice from input video)sync_mode: Mode to sync text to video when lengths don’t match (default: “bounce”)lipsync_model: Sync.so lipsync model (default: “lipsync-2”)tts_model: ElevenLabs text-to-speech model (default: “eleven_multilingual_v2”)gpt_model: OpenAI GPT model for translation (default: “gpt-3.5-turbo”)transcription_model: OpenAI model for transcription (default: “whisper-1”)segment_start: Start time of video segment to translate/dub (in seconds, -1 for entire video)segment_end: End time of video segment to translate/dub (in seconds, -1 for entire video)Execute the Python script:
This command will start the process of translating/dubbing the video based on the configuration in args.py.
On completion, a JSON file will be saved to the path specified in output_json_path, containing the following information:
input_video: URL of the original video that was processedgenerated_audio: URL to the translated audio filelipsync_jobID: Unique ID for the lip-sync joboutputUrl: URL to access the final translated/dubbed videovoice_id: ID of the voice used in the translation (automatically generated if not provided)upload_file_uguu() in FileProcessor.py.LipSyncService.py or use fetch_updates.py to retrieve output URLs using the output_json_path.