Skip to main content

FastDub

PyPI version Downloads Python versions License GitHub stars

FastDub is a Python package and command-line utility for automated subtitle voiceovers, video dubbing, audio ducking, dynamic voice changing, subtitle translation, and YouTube integration.


Features

  • Automated Video Dubbing: Generate speech from subtitle files (.srt, .vtt) and embed the audio into videos (.mp4, .mkv).
  • Audio Ducking (Sidechain Compression): Dynamically lower original background audio level while speech is active.
  • Dynamic Voice Changing: Switch voices mid-track using subtitle anchors (!:).
  • Subtitle Translation: Auto-translate subtitles to target languages using Google Translate or alternative services.
  • YouTube Integration: Download video playlists/channels, search YouTube directly from CLI, and upload dubbed videos back to YouTube with translated titles and descriptions.
  • Cross-Platform: Support for SAPI voices on Windows and eSpeak/RHVoice on Linux.

Installation

System Dependencies

Ubuntu / Debian

sudo apt update -y && sudo apt upgrade -y
sudo apt install -y python3 python3-pip ffmpeg espeak libxml2-dev libxslt1-dev

macOS

brew install ffmpeg espeak

Installing FastDub

Via PyPI with pip

# Core package
pip install FastDub

# Install all optional dependencies (Translation + YouTube support)
pip install "FastDub[ALL]"

Extra Feature Bundles

Extra Description Command
TR Subtitle translation support pip install "FastDub[TR]"
YT YouTube downloading and search pip install "FastDub[YT]"
YTU YouTube video uploading pip install "FastDub[YTU]"
ALL All optional features combined pip install "FastDub[ALL]"

Via Poetry

poetry add fastdub --extras "all"

Quick Start

Basic Local Video Dubbing

To voiceover all videos in a target directory:

fastdub -i ./input_folder -v "Yuriy" --no-sidechain -sf srt -vf mp4

Or using python module invocation:

python -m fastdub -i ./input_folder -l ru

Subtitle Translation

Translate subtitles to Russian before voice acting:

fastdub -i ./input_folder -tr -l ru -ts google

YouTube Download & Dubbing

Process a single YouTube video:

fastdub -yt -i "https://youtu.be/DD5UKQggXTc" -l ru

Process videos from a YouTube Search query:

fastdub -yt -yts -i "#python" -yts-l 5 -l ru

Process an entire YouTube channel:

fastdub -yt -i "c/UCi-5OZ2tYuwMLIcEyOsbdRA" -l ru

YouTube Upload Setup

To upload processed videos to YouTube (FastDub[YTU]):

  1. Go to Google Cloud Console Credentials.
  2. Create OAuth 2.0 Client ID for Desktop App.
  3. Download the JSON credentials file and place it in your working directory as client_secrets.json.
  4. Run FastDub with upload flags:
fastdub -i ./input_folder -ytu -ytu-ps private -ytu-t

Advanced Usage

Dynamic Voice Anchors

Change the active voice actor for specific sections by inserting anchor tokens in your subtitle file.

Example SRT subtitle content:

1
00:00:01,000 --> 00:00:04,000
!:Yuriy Hello, welcome to this video!

2
00:00:04,500 --> 00:00:08,000
!:Elena Here is the next speaker.

If voice anchors are updated and cached files need to be refreshed, clear the cache using -rc:

fastdub -i ./input_folder -rc 1

Command Line Arguments Reference

usage: fastdub [-h] [-rc {0,1,2}] [-ra | --cleanup-audio | -n-ra | --no-cleanup-audio]
               [-ev | --export-video | -n-ev | --no-export-video] [-l LANGUAGE]
               [-ll {CRITICAL,FATAL,ERROR,WARN,WARNING,INFO,DEBUG,NOTSET}]
               [-tc THREADS_COUNT] -i INPUT [-vf VIDEO_FORMAT] [-sf SUBTITLES_FORMAT]
               [-En EXCLUDE [EXCLUDE ...]] [-Eu EXCLUDE_UNDERSCORE]
               [-sc | --sidechain | -n-sc | --no-sidechain]
               [-sc-args SIDECHAIN_FFMPEG_PARAMS] [-sc-lvl SIDECHAIN_LEVEL_SC]
               [-v VOICE] [-a ALIGN] [-v-set-a VOICE_SET_ANCHOR]
               [-fll {trace,debug,verbose,info,warning,error,fatal,panic,quiet}]
               [-y | --confirm | -n-y | --no-confirm] [-af AUDIO_FORMAT] [-wm WATERMARK]
               [-tb | --traceback | -n-tb | --no-traceback] [-yt]
               [-ak API_KEYS [API_KEYS ...]] [-yts] [-yts-l YOUTUBE_SEARCH_LIMIT]
               [-yts-rg YOUTUBE_SEARCH_REGION] [-ytu]
               [-ytu-ps {private,public,unlisted}] [-ytu-t] [-tr] [--rewrite-srt | --no-rewrite-srt]
               [-ts TRANSLATE_SERVICE]

Python API Usage

FastDub modules can be imported directly into Python applications:

from fastdub import GlobalSettings, dubber

GlobalSettings.language = "ru"
GlobalSettings.threads_count = 4

# Perform dubbing operation programmatically
dubber.dub(
    input_dir="./media",
    voice="Yuriy",
    export_video=True,
    sidechain=True
)

Development & Publishing

FastDub uses Poetry for build backend management.

Build Package

poetry build

Publish Package

poetry publish

Issues & Support

If you encounter any issues or have feature requests, please open an issue on GitHub Issues.


License

Distributed under the MIT License. See LICENSE for details.

Download files

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

Source Distribution

fastdub-3.8.1.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

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

fastdub-3.8.1-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file fastdub-3.8.1.tar.gz.

File metadata

  • Download URL: fastdub-3.8.1.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.14 Linux/7.1.4-zen1

File hashes

Hashes for fastdub-3.8.1.tar.gz
Algorithm Hash digest
SHA256 461dbcb0a2322e0febbce119d4ed59ae7caefa842500729a256ef6f648a815d4
MD5 9ce9152f57953e761425e15a564ea19d
BLAKE2b-256 b1d96c976c2966e6aca62b02ea2f8bdb7438cbf90e794625b89fc49ef0dd065f

See more details on using hashes here.

File details

Details for the file fastdub-3.8.1-py3-none-any.whl.

File metadata

  • Download URL: fastdub-3.8.1-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.13.14 Linux/7.1.4-zen1

File hashes

Hashes for fastdub-3.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9a49204ed23f92737b199d03b3dbc6ddc61405235d12380ee423744d5a5fc6b
MD5 f75bfd24d2543be98f32866a320f0523
BLAKE2b-256 2781ba142abee921aef16c7831bf2192cdaf64159a2c933285c566f20a08c67f

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