A Python CLI package for voice over subtitles, with the ability to embed in video, audio ducking, and dynamic voice changer for a single track; auto translating; download and upload to YouTube supports
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
Install for Ubuntu
sudo apt update -y && sudo apt upgrade -y
sudo apt install python3 python3-pip ffmpeg espeak libxml2-dev libxslt1-dev
; libxml for translator functions
sudo python3 -m pip install -U pip setuptools wheel
sudo python3 -m pip install -U PyFastDub
Install all dependencies
pip install PyFastDub[ALL] # default
Youtube support
Youtube argument group
pip install PyFastDub[YT]
Process all videos from a channel
To get the channel id if it only has a username, run the JS code in the browser console:
document.querySelector("body>link").href
Then, in the input parameter, you can pass a link to the channel (with an id, not with a username) or a string of the format "c/CHANNEL_ID"
For example:
python -m fastdub -i "c/UCi-5OZ2tYuwMLIcEyOsbdRA" -yt
YouTube Search argument group
That the input data was a request to YouTube, they must begin with "?".
For Example:
python -m fastdub -i "?#python" -yt -yts-l 5
YouTube Upload argument group
pip install PyFastDub[YTU]
To download, you need to go to credentials (Create a new project if needed) > + Create credentials > OAuth Client ID > Desktop App
After filling in the required fields, DOWNLOAD JSON format and save to a working folder under the name client_secrets.json
-
Specifying the -ytu-ps argument as non-private may result in processing errors, but this was not observed during testing.
-
Please note that video uploads require a large amount of quota ( default has 10,000 per day)
Subtitles translate
Translate 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 haruka desktop - japanese,microsoft david desktop -
english (united states),microsoft huihui desktop - chinese (simplified,aleksandr-hq,arina,artemiy,evgeniy-eng,evgeniy-rus,lyubov,marianna,mikhail,pavel,tatiana,vict
oria,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 ...]]
[-yts] [-yts-l YOUTUBE_SEARCH_LIMIT] [-yts-rg YOUTUBE_SEARCH_REGION]
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 = remove 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)
-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 haruka desktop - japanese,microsoft david desktop - english (unit
ed states),microsoft huihui desktop - chinese (simplified),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 haruka desktop - japanese,microsoft david d
esktop - english (united states),microsoft huihui desktop - chinese (simplified),aleksandr-hq,arina,artemiy,evgeniy-eng,evgeniy-rus,lyubov,marianna,mikhail,pavel,ta
tiana,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
YouTube:
-yt, --youtube
-ak API_KEYS [API_KEYS ...], --api-keys API_KEYS [API_KEYS ...]
Youtube API key/s
YouTube Search:
-yts, --youtube-search
The input data is a query for searching on YouTube. (Adds "?" at the start of input)
-yts-l YOUTUBE_SEARCH_LIMIT, --youtube-search-limit YOUTUBE_SEARCH_LIMIT
Sets limit to the number of results. Defaults to 20.
-yts-rg YOUTUBE_SEARCH_REGION, --youtube-search-region YOUTUBE_SEARCH_REGION
Sets the result region. Defaults to "US".
If the voice set after !: is not selected during voiceover, clear the cache with the -rc argument
Example
python -m fastdub -i DirToDub -v "Yuriy" --no-sidechain -sf vtt -vf mkv
All files in the folder will be voices (*.mkv, *.vtt)
Default is mp4 video and srt subtitles.
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 -yt -i https://youtu.be/DD5UKQggXTc -v "Yuriy" -l ru
YouTube Search Example
python -m fastdub -yt -yts -i "#annoyingorange" -l ru
Translate Example
python -m fastdub -i DirToDub -tr -ts iciba -l ru
Default service is Google.
Other
The fastdub.utils
module stores helper functions.
python -m pydoc -w fastdub
You can write your issues on GitHub in English or in Russian.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file PyFastDub-3.0.0.tar.gz
.
File metadata
- Download URL: PyFastDub-3.0.0.tar.gz
- Upload date:
- Size: 40.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eeae910f1452cacd474bf10040a0fa8ec531b56549c06cbb8a9a7945f334c4e5 |
|
MD5 | 354be7eb0131e627d7e14acb249ac6ef |
|
BLAKE2b-256 | e85f2b29f5b7c6a6ecc60bb1d362fc8ada9e4e5ddc2c74e1cb5c4aac256137f7 |
File details
Details for the file PyFastDub-3.0.0-py3-none-any.whl
.
File metadata
- Download URL: PyFastDub-3.0.0-py3-none-any.whl
- Upload date:
- Size: 49.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aff9e84f03cf9b84ac306d6468b9c6e36ff5b34872e839b3d4a06fbf1993dfb9 |
|
MD5 | d81b9cceb5efc9baf08d7731c5f88db0 |
|
BLAKE2b-256 | 57cb4cfee5ccb61ccabc081af15fb503a6b13c07c91c877f96d1d702742d9d7b |