[简体中文](README.md) | English ## Project Introduction ![License](https://img.shields.io/badge/License-Apache%202-red.svg) ![python version](https://img.shields.io/badge/Python-3.8+-blue.svg) ![support os](https://img.shields.io/badge/OS-Windows/macOS/Linux-green.svg) Video-subtitle-remover (VSR) is an AI-based software that removes hardcoded subtitles from videos. It mainly implements the following functionalities: - **Lossless resolution**: Removes hardcoded subtitles from videos and generates files without subtitles. - Fills in the removed subtitle text area using a powerful AI algorithm model (non-adjacent pixel filling and mosaic removal). - Supports custom subtitle positions by only removing subtitles in the defined location (input position). - Supports automatic removal of all text throughout the entire video (without inputting a position). - Supports multi-selection of images for batch removal of watermark text.

demo.png

> Download the .zip package directly, extract, and run it. If it cannot run, follow the tutorial below to try installing the conda environment and running the source code. **Download Links:** Windows GPU Version v1.1.0 (GPU): - Baidu Cloud Disk: vsr_windows_gpu_v1.1.0.zip Extraction Code: **vsr1** - Google Drive: vsr_windows_gpu_v1.1.0.zip > For use only by users with Nvidia graphics cards (AMD graphics cards are not supported). ## Demonstration - GUI:

demo2.gif

- Click to view demo video👇

demo.gif

## Source Code Usage Instructions > **Do not use this project without an Nvidia graphics card**. The minimum requirements are: > > **GPU**: GTX 1060 or higher graphics card > > CPU: Supports AVX instruction set #### 1. Download and install Miniconda - Windows: Miniconda3-py38_4.11.0-Windows-x86_64.exe - Linux: Miniconda3-py38_4.11.0-Linux-x86_64.sh #### 2. Create and activate a virtual environment (1) Switch to the source code directory: ```shell cd ``` > For example, if your source code is in the `tools` folder on drive D, and the source code folder name is `video-subtitle-remover`, enter `cd D:/tools/video-subtitle-remover-main`. (2) Create and activate the conda environment: ```shell conda create -n videoEnv python=3.8 ``` ```shell conda activate videoEnv ``` #### 3. Install dependencies Please make sure you have already installed Python 3.8+, use conda to create a project virtual environment and activate the environment (it is recommended to create a virtual environment to run to avoid subsequent problems). - Install **CUDA** and **cuDNN**
Linux
(1) Download CUDA 11.7
wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
(2) Install CUDA 11.7
sudo sh cuda_11.7.0_515.43.04_linux.run

1. Input accept

2. make sure CUDA Toolkit 11.7 is chosen (If you have already installed driver, do not select Driver)

3. Add environment variables

add the following content in ~/.bashrc

# CUDA
      export PATH=/usr/local/cuda-11.7/bin${PATH:+:${PATH}}
      export LD_LIBRARY_PATH=/usr/local/cuda-11.7/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

Make sure it works

source ~/.bashrc
(3) Download cuDNN 8.4.1

cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz

(4) Install cuDNN 8.4.1
 tar -xf cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz
     mv cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive cuda
     sudo cp ./cuda/include/* /usr/local/cuda-11.7/include/
     sudo cp ./cuda/lib/* /usr/local/cuda-11.7/lib64/
     sudo chmod a+r /usr/local/cuda-11.7/lib64/*
     sudo chmod a+r /usr/local/cuda-11.7/include/*
Windows
(1) Download CUDA 11.7
cuda_11.7.0_516.01_windows.exe
(2) Install CUDA 11.7
(3) Download cuDNN 8.4.0

cudnn-windows-x86_64-8.4.0.27_cuda11.6-archive.zip

(4) Install cuDNN 8.4.0

unzip "cudnn-windows-x86_64-8.4.0.27_cuda11.6-archive.zip", then move all files in "bin, include, lib" in cuda directory to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\

- Install GPU version of Paddlepaddle: - windows: ```shell python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html ``` - Linux: ```shell python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/linux/mkl/avx/stable.html ``` - Install GPU version of Pytorch: ```shell conda install pytorch==2.1.0 torchvision==0.16.0 pytorch-cuda=11.8 -c pytorch -c nvidia ``` or use ```shell pip install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cu118 ``` - Install other dependencies: ```shell pip install -r requirements.txt ``` #### 4. Run the program - Run the graphical interface ```shell python gui.py ``` - Run the command line version (CLI) ```shell python ./backend/main.py ``` ## Common Issues 1. How to deal with slow removal speed You can greatly increase the removal speed by modifying the parameters in backend/config.py: ```python MODE = InpaintMode.STTN # Set to STTN algorithm STTN_SKIP_DETECTION = True # Skip subtitle detection ``` 2. What to do if the video removal results are not satisfactory Modify the values in backend/config.py and try different removal algorithms. Here is an introduction to the algorithms: > - **InpaintMode.STTN** algorithm: Good for live-action videos and fast in speed, capable of skipping subtitle detection > - **InpaintMode.LAMA** algorithm: Best for images and effective for animated videos, moderate speed, unable to skip subtitle detection > - **InpaintMode.PROPAINTER** algorithm: Consumes a significant amount of VRAM, slower in speed, works better for videos with very intense movement - Using the STTN algorithm ```python MODE = InpaintMode.STTN # Set to STTN algorithm # Number of neighboring frames, increasing this will increase memory usage and improve the result STTN_NEIGHBOR_STRIDE = 10 # Length of reference frames, increasing this will increase memory usage and improve the result STTN_REFERENCE_LENGTH = 10 # Set the maximum number of frames processed simultaneously by the STTN algorithm, a larger value leads to slower processing but better results # Ensure that STTN_MAX_LOAD_NUM is greater than STTN_NEIGHBOR_STRIDE and STTN_REFERENCE_LENGTH STTN_MAX_LOAD_NUM = 30 ``` - Using the LAMA algorithm ```python MODE = InpaintMode.LAMA # Set to LAMA algorithm LAMA_SUPER_FAST = False # Ensure quality ``` 3. CondaHTTPError Place the .condarc file from the project in the user directory (C:/Users/). If the file already exists in the user directory, overwrite it. Solution: https://zhuanlan.zhihu.com/p/260034241 4. 7z file extraction error Solution: Upgrade the 7-zip extraction program to the latest version. ```shell pip install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cu118 ```