### Clone Repository and Setup Environment with uv Source: https://github.com/huanshere/videolingo/blob/main/README.md Clone the VideoLingo repository and use uv to set up the Python environment and install dependencies. This is the recommended installation method. ```bash git clone https://github.com/Huanshere/VideoLingo.git cd VideoLingo ``` ```bash python setup_env.py ``` -------------------------------- ### Setup Environment with uv Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/start.en-US.md Use the setup_env.py script to automatically install uv, Python 3.10, and all project dependencies in an isolated environment. ```bash python setup_env.py ``` -------------------------------- ### Start VideoLingo Application Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/introduction.en-US.md Launch the VideoLingo application using Streamlit. This command starts the web interface for the tool. ```bash streamlit run st.py ``` -------------------------------- ### Install VideoLingo Dependencies Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/introduction.en-US.md Create a conda environment for VideoLingo with Python 3.10 and install the project dependencies using the provided script. Ensure you activate the environment before installation. ```bash conda create -n videolingo python=3.10.0 -y conda activate videolingo python install.py ``` -------------------------------- ### Install pyngrok and Set Ngrok Token Source: https://github.com/huanshere/videolingo/blob/main/VideoLingo_colab.ipynb Installs the pyngrok library and sets your ngrok authentication token. Replace 'YOUR_TOKEN_HERE' with your actual ngrok token obtained from the ngrok website. ```python !pip install pyngrok from pyngrok import ngrok #! SET Ngrok Authtoken Here ngrok.set_auth_token("YOUR_TOKEN_HERE") ``` -------------------------------- ### Install VideoLingo Dependencies Source: https://github.com/huanshere/videolingo/blob/main/VideoLingo_colab.ipynb Run this script to install the core Python dependencies for VideoLingo. It also handles the creation of a config.py file for API keys and base URLs. ```python !python install.py ``` -------------------------------- ### Install FFmpeg on Linux Source: https://github.com/huanshere/videolingo/blob/main/README.md Use apt to install FFmpeg on Debian/Ubuntu systems. This is a required dependency for VideoLingo. ```bash sudo apt install ffmpeg ``` -------------------------------- ### Install FFmpeg on Windows Source: https://github.com/huanshere/videolingo/blob/main/README.md Use Chocolatey to install FFmpeg on Windows. This is a required dependency for VideoLingo. ```bash choco install ffmpeg ``` -------------------------------- ### Clone Repository and Install Dependencies with Conda Source: https://github.com/huanshere/videolingo/blob/main/README.md Clone the VideoLingo repository and install dependencies using Conda. Note: This method is not recommended for future use. ```bash git clone https://github.com/Huanshere/VideoLingo.git cd VideoLingo ``` ```bash conda create -n videolingo python=3.10.0 -y conda activate videolingo python install.py ``` -------------------------------- ### Start VideoLingo Application with uv Source: https://github.com/huanshere/videolingo/blob/main/README.md Run the Streamlit application after setting up the environment with uv. This command differs for Windows and macOS/Linux. ```bash .venv\Scripts\streamlit run st.py # Windows ``` ```bash .venv/bin/streamlit run st.py # macOS / Linux ``` -------------------------------- ### Install FFmpeg on macOS Source: https://github.com/huanshere/videolingo/blob/main/README.md Use Homebrew to install FFmpeg on macOS. This is a required dependency for VideoLingo. ```bash brew install ffmpeg ``` -------------------------------- ### Run Installation Script with Conda Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/start.en-US.md Execute the install.py script to install project dependencies within the activated Conda environment. The script handles dependency order. ```bash python install.py ``` -------------------------------- ### Manually Install spaCy Model Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/start.en-US.md Use this command to manually install a spaCy model when pip installs it to the user directory instead of the conda environment. Run the terminal as administrator or use the conda env's Python. ```bash python -m pip install xx-core-web-md --no-user --force-reinstall --no-deps ``` -------------------------------- ### Configure GPT-SoVITS Model Paths Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/start.en-US.md Example configuration for using custom trained models with GPT-SoVITS. Ensure `t2s_weights_path` and `vits_weights_path` correctly point to your model files. ```yaml # Example config for method b: t2s_weights_path: GPT_weights_v2/Huanyu_v2-e10.ckpt version: v2 vits_weights_path: SoVITS_weights_v2/Huanyu_v2_e10_s150.pth ``` -------------------------------- ### Install PyTorch with CUDA Support Source: https://github.com/huanshere/videolingo/blob/main/VideoLingo_colab.ipynb Installs PyTorch and Torchaudio with CUDA 11.8 support, along with Triton and Lit. Ensure your environment has a compatible CUDA version. ```python Collecting torch==2.0.0 Downloading https://download.pytorch.org/whl/cu118/torch-2.0.0%2Bcu118-cp310-cp310-linux_x86_64.whl (2267.3 MB) [2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[32m2.3/2.3 GB[31m 626.3 kB/s[31m eta [36m0:00:00[31m[36m[0m [?25hCollecting torchaudio==2.0.0 Downloading https://download.pytorch.org/whl/cu118/torchaudio-2.0.0%2Bcu118-cp310-cp310-linux_x86_64.whl (4.4 MB) [2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[32m4.4/4.4 MB[31m 84.8 MB/s[31m eta [36m0:00:00[31m[36m[0m Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from torch==2.0.0) (3.16.1) Requirement already satisfied: typing-extensions in /usr/local/lib/python3.10/dist-packages (from torch==2.0.0) (4.12.2) Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch==2.0.0) (1.13.3) Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch==2.0.0) (3.3) Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch==2.0.0) (3.1.4) Collecting triton==2.0.0 (from torch==2.0.0) Downloading https://download.pytorch.org/whl/triton-2.0.0-1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (63.3 MB) [2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[32m63.3/63.3 MB[31m 11.3 MB/s[31m eta [36m0:00:00[31m[36m[0m Requirement already satisfied: cmake in /usr/local/lib/python3.10/dist-packages (from triton==2.0.0->torch==2.0.0) (3.30.3) Collecting lit (from triton==2.0.0->torch==2.0.0) Downloading https://download.pytorch.org/whl/lit-15.0.7.tar.gz (132 kB) [2K [90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━[32m132.3/132.3 kB[31m 11.3 MB/s[31m eta [36m0:00:00[31m[36m[0m Preparing metadata (setup.py) ... [?25l[?25hdone ``` -------------------------------- ### Install FFmpeg via Package Managers Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/start.en-US.md Install FFmpeg using system package managers. Avoid using conda-forge's ffmpeg due to missing encoders. ```bash choco install ffmpeg ``` ```bash brew install ffmpeg ``` ```bash sudo apt install ffmpeg ``` ```bash sudo dnf install ffmpeg ``` -------------------------------- ### App Component Setup Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/_app.mdx The main App component for a Next.js application. It sets up global styles, integrates Google Analytics, and embeds an external chat widget script. ```javascript import './globals.css' import { GoogleAnalytics } from '@next/third-parties/google' export default function App({ Component, pageProps }) { return ( <> ) } ``` -------------------------------- ### Clone VideoLingo Repository Source: https://github.com/huanshere/videolingo/blob/main/VideoLingo_colab.ipynb Clones the VideoLingo repository from GitHub and changes the current directory to the cloned repository. Ensure you have Git installed and a stable internet connection. ```python !git clone https://github.com/Huanshere/VideoLingo.git %cd VideoLingo ``` -------------------------------- ### Start Streamlit App and Ngrok Tunnel Source: https://github.com/huanshere/videolingo/blob/main/VideoLingo_colab.ipynb Launches the Streamlit application and creates an ngrok tunnel to make it accessible externally. This script handles subprocess management for Streamlit and ngrok, printing output and managing shutdown. ```python import subprocess import threading import sys from pyngrok import ngrok from rich import print as rprint from rich.panel import Panel def print_output(process): for line in iter(process.stdout.readline, ''): sys.stdout.write(line) for line in iter(process.stderr.readline, ''): sys.stderr.write(line) # Start Streamlit streamlit_process = subprocess.Popen( ["streamlit", "run", "st.py"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, bufsize=1 ) # Create and start the output printing thread output_thread = threading.Thread(target=print_output, args=(streamlit_process,)) output_thread.start() # Create a tunnel using ngrok public_url = ngrok.connect(8501) rprint(Panel(f"Streamlit is available at Ngrok ⬇️", expand=False)) print(f"Click 👉 {public_url}") # Keep the program running ngrok_process = ngrok.get_ngrok_process() try: streamlit_process.wait() except KeyboardInterrupt: print("Interrupted by user, shutting down...") finally: ngrok.kill() streamlit_process.terminate() output_thread.join() ``` -------------------------------- ### Clone VideoLingo Repository Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/introduction.en-US.md Clone the VideoLingo repository to your local machine. This is the first step in setting up the project. ```bash git clone https://github.com/Huanshere/VideoLingo.git cd VideoLingo ``` -------------------------------- ### Build and Run VideoLingo Docker Image Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/docker.en-US.md Builds the Docker image locally and then runs it as a detached container, exposing port 8501 and enabling all GPUs. ```bash docker build -t videolingo . docker run -d -p 8501:8501 --gpus all videolingo ``` -------------------------------- ### Run VideoLingo with Mounted Model Weights Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/docker.en-US.md Runs the VideoLingo container, mounting a local directory containing pre-downloaded model weights to the container's cache directory. This bypasses the automatic download on first run. ```bash docker run -d -p 8501:8501 --gpus all -v /path/to/your/model:/app/_model_cache rqlove/videolingo:latest ``` -------------------------------- ### Build and Run VideoLingo with Docker Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/introduction.en-US.md Build a Docker image for VideoLingo and run it as a detached container. This method requires CUDA 12.4 and NVIDIA Driver version >550. ```bash docker build -t videolingo . docker run -d -p 8501:8501 --gpus all videolingo ``` -------------------------------- ### Pull and Run VideoLingo from DockerHub Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/docker.en-US.md Pulls the latest pre-built VideoLingo image from DockerHub and runs it as a detached container with port mapping and GPU support. ```bash docker pull rqlove/videolingo:latest docker run -d -p 8501:8501 --gpus all rqlove/videolingo:latest ``` -------------------------------- ### Create Conda Virtual Environment Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/start.en-US.md Create a Conda virtual environment specifically for VideoLingo, ensuring Python version 3.10.0 is used. ```bash conda create -n videolingo python=3.10.0 -y conda activate videolingo ``` -------------------------------- ### Configure VideoLingo Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/docs/start.en-US.md Manually adjust settings in the config.yaml file for more advanced configurations. Custom terms can be added to custom_terms.xlsx. ```yaml custom_terms.xlsx | French bread | Not just any bread! ``` -------------------------------- ### VideoLingo Landing Page Component Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/index.en-US.mdx This React component renders the main landing page for VideoLingo. It structures data for hero section, features, testimonials, and FAQs, passing it to a reusable Landing component. ```javascript export default function Component() { const landingData = { hero: { title: "VideoLingo: Connecting Every Frame Across the World", description: "Netflix-level subtitle cutting, translation, alignment, and even dubbing - one-click fully automated video localization AI subtitle team", videoSrc: "/videos/demo.mp4" }, features: { title: "Powerful Features, Unleash Creativity", items: [ { title: 'Intelligent Subtitle Segmentation', description: 'Using NLP and LLM technologies to accurately segment subtitles based on sentence meaning, ensuring each phrase is just right.', icon: 'CheckCircle', }, { title: 'Context-Aware Translation', description: 'GPT summarizes and extracts terminology knowledge base, achieving context-coherent translation, making every sentence natural and fluent.', icon: 'ArrowRight', }, { title: 'Three-Step Translation Process', description: 'Direct translation - Reflection - Paraphrasing, multiple safeguards, rivaling the quality of professional subtitle team translations.', icon: 'CheckCircle', }, { title: 'Precise Subtitle Alignment', description: 'Using WhisperX for word-level timeline subtitle recognition, ensuring every word is accurately synchronized.', icon: 'ArrowRight', }, { title: 'High-Quality Dubbing', description: 'Supports various TTS solutions, including high-quality personalized dubbing with GPT-SoVITS technology, making videos more appealing.', icon: 'CheckCircle', }, { title: 'Developer-Friendly', description: 'Structured file design, convenient for developers to customize and extend functionality. Supports multiple deployment methods.', icon: 'ArrowRight', }, ] }, comments: { title: "They're All Using VideoLingo", items: [ { content: "What used to take a whole day now gets done in an hour!", author: "k", title: "Bilibili creator with 300k followers" }, { content: "This dubbing is even more accurate than my own speech, I suddenly have so many fun ideas 🤩", author: "Ah Biao", title: "Xiaohongshu Cantonese creator with 100k followers" }, { content: "I just posted it for fun after work, didn't expect it to blow up so quickly 😂", author: "X", title: "Douyin creator gaining 7k followers daily" } ] }, faq: { title: "Frequently Asked Questions", items: [ { question: "How is the translation quality?", description: "We strictly adhere to Netflix subtitle standards, using the most advanced Claude 3.5 model for multi-step translation." }, { question: "How long does it take to process a video?", answer: "Processing time depends on the length of the video and the selected services. Typically, a 60-minute video takes about 40 minutes to complete translation and dubbing." }, { question: "How is it priced?", answer: "VideoLingo is an open-source project that has already gained 3k+ stars on Github. A commercial version with more features is coming soon~" }, ] } } return } ``` -------------------------------- ### Fetch GitHub Repository and Stargazer Data Source: https://github.com/huanshere/videolingo/blob/main/docs/pages/index.en-US.mdx This function fetches repository data and recent stargazers from the GitHub API for static site generation. It uses Promise.all to handle concurrent fetches and sets a revalidation time. ```javascript export const getStaticProps = ({ params }) => { return Promise.all([ fetch(`https://api.github.com/repos/Huanshere/VideoLingo`).then(res => res.json()), fetch(`https://api.github.com/repos/Huanshere/VideoLingo/contributors?per_page=16`).then(res => res.json()) ]).then(([repo, stargazers]) => ({ props: { ssg: { stars: repo.stargazers_count, recentStargazers: stargazers } }, revalidate: 60 })) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.