Skip to main content

A Python package (+CLI) for voice over subtitles, with the ability to embed in video, audio ducking, and dynamic voice changer for a single track.

Project description

Package for voice over subtitles:

  • with the ability to embed in video,
  • audio ducking,
  • dynamic voice changer for a single track. Add "!: voice name" at the beginning of the subtitle line. (Applies to all subsequent ones)

pip install -U PyFastDub

Youtube support

Youtube argument group

pip install PyFastDub[YT]

To translate all videos on a channel, pass "c/CHANNEL_ID" to --input

To get the channel id if it only has a username, run the JS code in the browser console:

document.querySelector("body>link").href

For example:

python -m FastDub -i "c/UCi-5OZ2tYuwMLIcEyOsbdRA" -yt

Subtitles translate

Translate subtitles argument group

pip install PyFastDub[TR]

Usage

python -m FastDub --help

usage: FastDub [-h] [-rc {0,1,2}] [-rf CLEANUP_LEVEL] [-l LANGUAGE] [-tc THREADS_COUNT] [-i INPUT] [-vf VIDEO_FORMAT]
               [-sf SUBTITLES_FORMAT] [-En EXCLUDE [EXCLUDE ...]] [-Eu EXCLUDE_UNDERSCORE]
               [-sc | --sidechain | --no-sidechain] [-sc-msl MIN_SILENCE_LEN] [-sc-st SILENCE_THRESH]
               [-sc-gdo GAIN_DURING_OVERLAY]
               [-v {microsoft irina desktop - russian,microsoft zira desktop - english united states),microsoft david desktop - english (united states,aleksandr-hq,arina,artemiy,evgeniy-eng,evgeniy-rus,lyubov,marianna,mikhail,pavel,tatiana,victoria,vitaliy,volodymyr,yuriy}]
               [-a ALIGN] [-ll {trace,debug,verbose,info,warning,error,fatal,panic,quiet}]
               [-y | --confirm | --no-confirm] [-yt] [-ak API_KEYS [API_KEYS ...]] [-tr]
               [--rewrite-srt | --no-rewrite-srt]
               [-ts {alibaba,argos,baidu,bing,caiyun,deepl,google,iciba,iflytek,itranslate,papago,reverso,sogou,tencent,translateCom,utibet,yandex,youdao}]

FastDub is a tool for dubbing videos by subtitle files.

options:
  -h, --help            show this help message and exit
  -rc {0,1,2}, --remove-cache {0,1,2}
                        Remove all cache (_cached_texts directory) files
                                0 - No remove cache
                                1 - Delete cache before voice acting
                                2 - Delete cache after voice acting (default)
  -rf CLEANUP_LEVEL, --cleanup-level CLEANUP_LEVEL
                        Cleanup level   0 = No removing any files
                                > 0 remove audio from video (default)
                                > 1 = remove dubbed audio if video exists
                                > 2 = reomve dubbed cache files
  -l LANGUAGE, --language LANGUAGE
                        Subtitles language (ru)
  -tc THREADS_COUNT, --threads-count THREADS_COUNT
                        Process count to download (pass to cpu count, < 2 to disable)
                                *N = N * cpu count

Input:
  -i INPUT, --input INPUT
                        Input directory/YouTube Playlist/Video URL.
  -vf VIDEO_FORMAT, --video-format VIDEO_FORMAT
                        Video format (default .mp4).
  -sf SUBTITLES_FORMAT, --subtitles-format SUBTITLES_FORMAT
                        Subtitles format (default .srt).

Audio Ducking:
  -sc, --sidechain, --no-sidechain
                        Enable audio side chain compress (ducking) (default: True)
  -sc-msl MIN_SILENCE_LEN, --min-silence-len MIN_SILENCE_LEN, --attack MIN_SILENCE_LEN
                        Minimum silence length in ms (default 100)
  -sc-st SILENCE_THRESH, --silence-thresh SILENCE_THRESH
                        Silence threshold in dB
  -sc-gdo GAIN_DURING_OVERLAY, --gain-during-overlay GAIN_DURING_OVERLAY
                        Gain during overlay in dB (-11)

Voicer:
  -v {microsoft irina desktop - russian,microsoft zira desktop - english (united states),microsoft david desktop - english (united states),aleksandr-hq,arina,artemiy,evgeniy-eng,evgeniy-rus,lyubov,marianna,mikhail,pavel,tatiana,victoria,vitaliy,volodymyr,yuriy}, --voice {microsoft irina desktop - russian,microsoft zira desktop - english (united states),microsoft david desktop - english (united states),aleksandr-hq,arina,artemiy,evgeniy-eng,evgeniy-rus,lyubov,marianna,mikhail,pavel,tatiana,victoria,vitaliy,volodymyr,yuriy}
                        SAPI voice for voice acting.
  -a ALIGN, --align ALIGN
                        Audio fit align
                                1 = right
                                2 = center (default)

FFMpeg Output:
  -ll {trace,debug,verbose,info,warning,error,fatal,panic,quiet}, --loglevel {trace,debug,verbose,info,warning,error,fatal,panic,quiet}
                        FFMpegWrapper loglevel
  -y, --confirm, --no-confirm
                        Don't ask for confirmation (default: True)

Youtube:
  -yt, --youtube
  -ak API_KEYS [API_KEYS ...], --api-keys API_KEYS [API_KEYS ...]
                        Youtube API key/s

Translate subtitles:
  -tr, --translate      Translate input subtitles files
  --rewrite-srt, --no-rewrite-srt
                        Rewrite input subtitles files.
                        If not, add "_" to the beginning of the original subtitle file. (default: False)
  -ts {alibaba,argos,baidu,bing,caiyun,deepl,google,iciba,iflytek,itranslate,papago,reverso,sogou,tencent,translateCom,utibet,yandex,youdao}, --translate-service {alibaba,argos,baidu,bing,caiyun,deepl,google,iciba,iflytek,itranslate,papago,reverso,sogou,tencent,translateCom,utibet,yandex,youdao}
                        Subtitle translation service. (default google)```

If the voice set after !: is not selected during voiceover, clear the cache with the -rc argument

Example

python -m FastDub DirToDub -v "Yuriy" --no-ducking -vf mkv

name is any name.

DirToDub:

  • name.srt
  • name.mkv
  • name2.srt
  • name2.mkv
  • andit.srt
  • andit.mkv

Then: name and name2 will be announced, and the results will be saved to a folder with the appropriate name.

YT Example

python -m FastDub https://youtu.be/DD5UKQggXTc -yt -v "Yuriy" -l ru

Translate Example

python -m FastDub DirToDub -tr -ts iciba -l ru

python -m pydoc -w FastDub

Download files

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

Source Distribution

PyFastDub-2.5.1.tar.gz (34.4 kB view details)

Uploaded Source

Built Distribution

PyFastDub-2.5.1-py3-none-any.whl (42.2 kB view details)

Uploaded Python 3

File details

Details for the file PyFastDub-2.5.1.tar.gz.

File metadata

  • Download URL: PyFastDub-2.5.1.tar.gz
  • Upload date:
  • Size: 34.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for PyFastDub-2.5.1.tar.gz
Algorithm Hash digest
SHA256 ba94d4bdf3ac994f2269256a4859f4d7fbc61e595b20da0243daba9295eba587
MD5 92fb719684c4006f0574e65c6b77c871
BLAKE2b-256 f76aae9a518583b1c57251d0e4476930780b334dda09b6ce48cfeb23f4b733b5

See more details on using hashes here.

File details

Details for the file PyFastDub-2.5.1-py3-none-any.whl.

File metadata

  • Download URL: PyFastDub-2.5.1-py3-none-any.whl
  • Upload date:
  • Size: 42.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for PyFastDub-2.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46498880bc113f4f1c7db18ba49ec0f62cd32ccaa1a19847ad8a8a8c32ce3ab8
MD5 0bbcaf3080409d0340542a4e2c2f2dab
BLAKE2b-256 ead73ef63e892061a369dd8f8db5781d1eb0af47c258fbbd2c75dfbb9855535a

See more details on using hashes here.

Supported by

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