Skip to content

Latest commit

 

History

History
267 lines (149 loc) · 10.1 KB

README_en_v2.md

File metadata and controls

267 lines (149 loc) · 10.1 KB

简体中文 / 👑 Donate to this project

Video Translation and Dubbing Tool

This is a video translation and dubbing tool that can translate a video from one language to a specified language and automatically generate and add subtitles and dubbing in that language.

The voice recognition supports faster-whisper, openai-whisper, GoogleSpeech, zh_recogn Ali Chinese voice recognition model.

Text translation supports Microsoft Translate | Google Translate | Baidu Translate | Tencent Translate | ChatGPT | AzureAI | Gemini | DeepL | DeepLX | Offline translation OTT, and includes a free ChatGPT API translation interface sponsored by (apiskey.top).

Text-to-speech synthesis supports Microsoft Edge tts, Google tts, Azure AI TTS, Openai TTS, Elevenlabs TTS, Custom TTS server API, GPT-SoVITS, clone-voice.

Allows retaining background accompaniment music, etc. (based on uvr5)

Supported languages: Simplified and Traditional Chinese, English, Korean, Japanese, Russian, French, German, Italian, Spanish, Portuguese, Vietnamese, Thai, Arabic, Turkish, Hungarian, Hindi, Ukrainian, Kazakh, Indonesian, Malay.

Main Uses and How to Use

【Translate videos and dub】Translate the audio in videos into the voice of another language and embed subtitles in that language

【Convert audio or video to subtitles】Recognize human speech in audio or video files as text and export to srt subtitle files

【Batch subtitle creation and dubbing】Create dubbing based on local existing srt subtitle files, supporting single or batch subtitles

【Batch subtitle translation】Translate one or more srt subtitle files into subtitles in other languages

【Audio, video, and subtitle merge】Merge audio files, video files, and subtitle files into one video file

【Extract audio from video】Extract as audio files and mute video from video

【Audio and video format conversion】Mutual conversion between various formats

【Download YouTube videos】Download videos from YouTube


994.mp4

Pre-Packaged Version (Only available for Win10/Win11, MacOS/Linux systems use source code deployment)

Packaged with pyinstaller, not anti-virus whitelisted or signed, anti-virus software may flag it, please add to trusted list or use source code deployment

  1. [Click to download the pre-packaged version, unzip to an English directory without spaces, then double-click sp.exe (https://github.com/jianchang512/pyvideotrans/releases)

  2. Unzip to an English path, and ensure the path does not contain spaces. After unzipping, double-click sp.exe (if you encounter permission issues, right-click to open as administrator)

  3. Note: Must be used after extracting, cannot be used directly within the compressed package, nor can the sp.exe file be moved to another location after extraction

MacOS Source Code Deployment

  1. Open a terminal window and execute these 3 commands respectively

    brew install libsndfile
    
    brew install ffmpeg
    
    brew install git
    
    brew install [email protected]
    
    

    Then proceed with the following 2 commands

    export PATH="/usr/local/opt/[email protected]/bin:$PATH"
    
    source ~/.bash_profile; source ~/.zshrc
    
    
  2. Create a folder without spaces and Chinese characters, and enter that folder in the terminal.

  3. Execute the command git clone https://github.com/jianchang512/pyvideotrans in the terminal.

  4. Execute the command cd pyvideotrans.

  5. Continue with python -m venv venv.

  6. Continue with the command source ./venv/bin/activate, confirming that the terminal prompt starts with (venv), the following commands must be sure the terminal prompt starts with (venv).

  7. Execute pip install -r requirements.txt --no-deps, if there's a failure prompt, switch to Aliyun mirror source and execute the following 2 commands

    pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
    pip config set install.trusted-host mirrors.aliyun.com
    

    Then retry. If the failure persists, try pip install -r requirements.txt --ignore-installed --no-deps.

  8. python sp.py to open the software interface.

  9. Ubuntu may also need to install the Libxcb library, installation commands are:

    
    sudo apt-get update
    sudo apt-get install libxcb-cursor0
    
    

Detailed MacOS deployment scheme

Linux Source Code Deployment

  1. CentOS/RHEL series execute the following commands in order to install python3.12

sudo yum update

sudo yum groupinstall "Development Tools"

sudo yum install openssl-devel bzip2-devel libffi-devel

cd /tmp

wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz

tar xzf Python-3.12.0.tgz

cd Python-3.12.0

./configure — enable-optimizations

sudo make && sudo make install

sudo alternatives — install /usr/bin/python3 python3 /usr/local/bin/python3.12 2

sudo yum install -y ffmpeg

Ubuntu/Debian series execute the following commands to install python3.12


apt update && apt upgrade -y

apt install software-properties-common -y

add-apt-repository ppa:deadsnakes/ppa

apt update

sudo apt-get install libxcb-cursor0

apt install python3.12

curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12

pip 23.2.1 from /usr/local/lib/python3.12/site-packages/pip (python 3.12)

sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.12 1

sudo update-alternatives --config python

apt-get install ffmpeg

Open any terminal, execute python3 -V, if it displays “3.12.0”, the installation is successful, otherwise it's a failure.

  1. Create a folder without spaces and Chinese characters, open the folder from the terminal.

  2. In the terminal execute the command git clone https://github.com/jianchang512/pyvideotrans.

  3. Continue with the command cd pyvideotrans.

  4. Continue with python -m venv venv.

  5. Continue with the command source ./venv/bin/activate, confirming that the terminal prompt starts with (venv).

  6. Execute pip install -r requirements.txt --no-deps, if there's a failure prompt, switch to Aliyun mirror source and execute the following 2 commands.

    
    pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
    pip config set install.trusted-host mirrors.aliyun.com
    
    

    Then retry. If the failure persists, try pip install -r requirements.txt --ignore-installed --no-deps.

  7. If you want to use CUDA acceleration, execute respectively

    pip uninstall -y torch torchaudio

    pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu118

    pip install nvidia-cublas-cu11 nvidia-cudnn-cu11

  8. To enable CUDA acceleration on Linux, you must have an NVIDIA card and have configured the CUDA11.8+ environment properly, see CUDA acceleration support.

  9. python sp.py to open the software interface.

Window10/11 Source Code Deployment

  1. Open https://www.python.org/downloads/ and download windows3.12, after downloading, keep clicking next, ensuring to select "Add to PATH".

    Open a cmd, execute python -V, if the output is not 3.12.3, it means there was an installation error, or "Add to PATH" was not selected, please reinstall.

  2. Open https://github.com/git-for-windows/git/releases/download/v2.45.0.windows.1/Git-2.45.0-64-bit.exe, download git, after downloading keep clicking next.

  3. Find a folder that does not contain spaces and Chinese characters, type cmd in the address bar and hit enter to open the terminal, all commands are to be executed in this terminal.

  4. Execute the command git clone https://github.com/jianchang512/pyvideotrans.

  5. Continue with the command cd pyvideotrans.

  6. Continue with python -m venv venv.

  7. Continue with the command .\venv\scripts\activate, ensuring the command line starts with (venv), otherwise, there's an error.

  8. If you want to use CUDA acceleration, execute respectively

    pip uninstall -y torch torchaudio

    pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu118

  9. To enable CUDA acceleration on Windows, you must have an NVIDIA card and have configured the CUDA11.8+ environment properly, see CUDA acceleration support.

  10. Linux If you want to use CUDA acceleration, you need to also install pip install nvidia-cublas-cu11 nvidia-cudnn-cu11.

  11. Unzip ffmpeg.zip to the current source code directory, overwrite if prompted, ensure you can see ffmpeg.exe, ffprobe.exe, ytwin32.exe, in the ffmepg folder within the source code.

  12. python sp.py to open the software interface.

Tutorial and Documentation

Please check https://pyvideotrans.com/guide.html

Voice Recognition Models:

Download address: https://pyvideotrans.com/model.html

Description and differences introduction: https://pyvideotrans.com/02.html

Video Tutorials (Third-party)

MacOS Source Code Deployment/Bilibili

How to Set Video Translation Using Gemini Api/Bilibili

How to Download and Install

Software Preview Screenshots

image

Related Projects

OTT: Local Offline Text Translation Tool

Voice Clone Tool: Synthesize Speech with Any Voice Color

Voice Recognition Tool: Local Offline Speech-to-Text Tool

Vocal Background Music Separator: Vocal and Background Music Separation Tool

Improved version of GPT-SoVITS's api.py

Acknowledgements

The main open source projects this program relies on:

  1. ffmpeg
  2. PySide6
  3. edge-tts
  4. faster-whisper
  5. openai-whisper
  6. pydub