Replaces and translates voices in youtube videos
Project description
TurnVoice
A command-line tool that replace voices in youtube videos and can also translate.
Installation
pip install turnvoice
For faster rendering prepare your CUDA environment:
CUDA 11.8:
pip install torch==2.1.1+cu118 torchaudio==2.1.1+cu118 --index-url https://download.pytorch.org/whl/cu118
CUDA v12.1:
pip install torch==2.1.1+cu118 torchaudio==2.1.1+cu211 --index-url https://download.pytorch.org/whl/cu211
Usage
turnvoice [-u] <YouTube Video URL|ID> [-l] <Translation Language> -r <Reference WAV File> -o <Output Video Filename>
For example, this is musk with the female default voice:
turnvoice RK91Ji6GCZ8
Same translated to german:
turnvoice RK91Ji6GCZ8 de
Parameters Explained:
-u
,--url
: (required) The YouTube video ID or URL you want to transform-l
,--language
: Language to translate to (supported: en, es, fr, de, it, pt, pl, tr, ru, nl, cs, ar, zh, ja, hu, ko) leaving this out keeps the source video language-d
,--download_directory
: Where to save the video downloads (default: 'downloads')-s
,--synthesis_directory
: Where to save the text to speech audio files (default: 'synthesis')-e
,--extract
: Use with -e to extract audio directly from the video (may lead to lower quality but can reduce likelihood of errors)-r
,--reference_wav
: Your chosen voice in wav format (24kHz, 16 bit, mono, ~10-30s)-o
,--output_video
: The grand finale video file name (default: 'final_cut.mp4')
You can leave out -u and -l as first parameters.
Example Command:
Ever wanted Arthur Morgan to narrate a cooking tutorial? Here's how:
turnvoice AmC9SmCBUj4 -r arthur.wav -o cooking_with_arthur.mp4
This example needs a arthur.wav (or.json) file in the same directory. Works when executed from the tests directory.
Pro Tips
The Art of Choosing a Reference Wav
- A 24000, 44100 or 22050 Hz 16-bit mono wav file of 10-30 seconds is your golden ticket.
- 24k mono 16 is my default, but I also had voices where I found 44100 32-bit to yield best results
- I test voices with this tool before rendering
- Audacity is your friend for adjusting sample rates. Experiment with frame rates for best results!
Fixed TTS Model Download Folder
Keep your models organized! Set COQUI_MODEL_PATH
to your preferred folder.
Windows example:
setx COQUI_MODEL_PATH "C:\Downloads\CoquiModels"
Future Improvements
- Optimized Synthesis: Reducing the synthesis tries for faster results.
- Voice Cloning from YouTube: Imagine cloning voices directly from other videos!
License
TurnVoice is proudly under the Coqui Public Model License 1.0.0 and NLLB-200 CC-BY-NC License (these are OpenSource NonCommercial licenses).
Let's Make It Fun! 🎉
Share your funniest or most creative TurnVoice creations with me!
And if you've got a cool feature idea or just want to say hi, drop me a line on
Don't forget to leave a star.
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
Hashes for TurnVoice-0.0.22-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55b13141bc027c2059d1cc0b3c26553f9662e1b0bcef9023cd36ca69b01bbd3b |
|
MD5 | 1d3df8f1b9544b98c0852e9af5891353 |
|
BLAKE2b-256 | 47e8a6268fc3c3510f85958abb32754b4996beb87a45fdee32c23512c5abcba9 |