Skip to main content

End-to-end video dubbing pipeline: transcribe, translate, and voice-clone.

Project description

Mazinger Dubber

Mazinger Dubber

End-to-end video dubbing pipeline. Download a video, transcribe it, translate the subtitles, clone a voice, and produce a fully dubbed audio or video file — in one command.

What It Does

Mazinger chains nine stages into a single pipeline:

  1. Download — fetch a video from a URL or ingest a local file, extract the audio track
  2. Transcribe — convert speech to SRT subtitles (OpenAI Whisper API, faster-whisper, or WhisperX)
  3. Thumbnails — use an LLM to pick key frames from the video for visual context
  4. Describe — analyze the transcript and thumbnails to produce a structured summary (title, key points, keywords)
  5. Translate — translate the SRT into another language with duration-aware word budgets
  6. Re-segment — merge fragments and split oversized subtitles for readability
  7. Speak — synthesize voice-cloned speech for every subtitle entry (Qwen3-TTS or Chatterbox)
  8. Assemble — place each audio segment on the original timeline with optional tempo adjustment, loudness matching, and background audio mixing
  9. Subtitle — burn styled subtitles into the video and/or mux the new audio track

Every stage can run independently or as part of the full pipeline. Interrupted runs resume automatically — completed stages and individual TTS segments are cached and skipped.

Prerequisites

  • Python 3.10 or later
  • ffmpeg installed and on PATH (apt install ffmpeg / brew install ffmpeg)
  • An OpenAI API key for LLM-powered stages (transcription, translation, thumbnails, description)
  • A CUDA GPU for local transcription and TTS (not needed for cloud-only workflows)

Installation

The base install covers download, transcription (cloud), thumbnails, description, translation, re-segmentation, and subtitle embedding. No GPU needed.

pip install mazinger

Add local transcription or TTS as optional extras:

# Local transcription
pip install "mazinger[transcribe-faster]"      # faster-whisper (Chatterbox-compatible)
pip install "mazinger[transcribe-whisperx]"    # WhisperX (best word-level alignment)

# Voice synthesis
pip install "mazinger[tts]"                    # Qwen3-TTS (voice sample + transcript)
pip install "mazinger[tts-chatterbox]"         # Chatterbox (voice sample only, emotion control)

# Full bundles
pip install "mazinger[all-qwen]"              # WhisperX + Qwen3-TTS
pip install "mazinger[all-chatterbox]"        # faster-whisper + Chatterbox

Qwen and Chatterbox require different transformers versions and cannot share an environment. WhisperX also conflicts with Chatterbox — pair it with Qwen, or use faster-whisper with Chatterbox.

See the Installation Guide for venv recipes, Colab setup, and uv overrides.

Quick Start

Dub a video in one command

mazinger dub "https://youtube.com/watch?v=VIDEO_ID" \
    --voice-sample speaker.m4a \
    --voice-script speaker_transcript.txt \
    --target-language Spanish \
    --base-dir ./output

Use a voice profile instead of local files

Voice profiles are hosted on HuggingFace and downloaded automatically:

mazinger dub "https://youtube.com/watch?v=VIDEO_ID" \
    --clone-profile abubakr \
    --target-language Arabic

Produce a video with burned subtitles

mazinger dub "https://youtube.com/watch?v=VIDEO_ID" \
    --clone-profile abubakr \
    --output-type video \
    --embed-subtitles \
    --subtitle-google-font "Noto Sans Arabic" \
    --subtitle-font-size 24

Run a single stage

Every stage has its own sub-command:

mazinger download   "https://youtube.com/watch?v=VIDEO_ID" --base-dir ./output
mazinger slice      "https://youtube.com/watch?v=VIDEO_ID" --start 00:01:00 --end 00:04:00
mazinger transcribe ./output/projects/my-video/source/audio.mp3 -o subs.srt
mazinger translate  --srt subs.srt --target-language French -o translated.srt
mazinger subtitle   video.mp4 --srt translated.srt -o output.mp4

Python API

from mazinger import MazingerDubber

dubber = MazingerDubber(openai_api_key="sk-...", base_dir="./output")

proj = dubber.dub(
    source="https://youtube.com/watch?v=VIDEO_ID",
    voice_sample="speaker.m4a",
    voice_script="speaker_transcript.txt",
    target_language="Spanish",
    output_type="video",
    embed_subtitles=True,
)

print(proj.final_video)   # ./output/projects/<slug>/tts/dubbed.mp4

Documentation

Full documentation lives in the docs/ directory:

Chapter Contents
Installation All install methods, extras, compatibility matrix, Colab and venv recipes
Quick Start Common workflows with copy-paste examples
Pipeline Overview How the nine stages connect, data flow, and resume behavior
CLI Reference Every command, flag, and default value
Python API Classes, functions, and parameters for programmatic use
Voice Profiles Using, creating, and uploading voice profiles
Subtitle Styling Fonts, colors, positioning, RTL support, Google Fonts
Configuration Environment variables, caching, tempo control, LLM usage tracking
Project Structure Output directory layout and file naming conventions

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mazinger-1.7.3.tar.gz (62.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mazinger-1.7.3-py3-none-any.whl (73.0 kB view details)

Uploaded Python 3

File details

Details for the file mazinger-1.7.3.tar.gz.

File metadata

  • Download URL: mazinger-1.7.3.tar.gz
  • Upload date:
  • Size: 62.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for mazinger-1.7.3.tar.gz
Algorithm Hash digest
SHA256 b7d3b1bd5cd33d7747a3206821a41c62b2ffcf49c4b7b2082e34acc701e8cf45
MD5 92f01ef477b339dbbe28c12f64b8928f
BLAKE2b-256 2b8fb049924f00530df14221d440404b7168c93fd27f394a9c95091d3f2e1176

See more details on using hashes here.

File details

Details for the file mazinger-1.7.3-py3-none-any.whl.

File metadata

  • Download URL: mazinger-1.7.3-py3-none-any.whl
  • Upload date:
  • Size: 73.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for mazinger-1.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 079ad4b9b9e1becc46a879330fba74cbbb403822ae20c27022820a1675adaa43
MD5 33b759bbc3eb71838c7c74b7ee63f25d
BLAKE2b-256 02e4a6db9636beab01af944372fd2bbf34c5c67a40f0f2ef2136f0504d298f22

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page