简体中文 | English
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.
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).
- GUI:
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) Switch to the source code directory:
cd <source_code_directory>
For example, if your source code is in the
tools
folder on drive D, and the source code folder name isvideo-subtitle-remover
, entercd D:/tools/video-subtitle-remover-main
.
(2) Create and activate the conda environment:
conda create -n videoEnv python=3.8
conda activate videoEnv
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
wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
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
cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz
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
cuda_11.7.0_516.01_windows.execudnn-windows-x86_64-8.4.0.27_cuda11.6-archive.zip
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:
python -m pip install paddlepaddle-gpu==2.4.2.post117 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
-
Linux:
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:
conda install pytorch==2.1.0 torchvision==0.16.0 pytorch-cuda=11.8 -c pytorch -c nvidia
or use
pip install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cu118
-
Install other dependencies:
pip install -r requirements.txt
- Run the graphical interface
python gui.py
- Run the command line version (CLI)
python ./backend/main.py
- How to deal with slow removal speed
You can greatly increase the removal speed by modifying the parameters in backend/config.py:
MODE = InpaintMode.STTN # Set to STTN algorithm
STTN_SKIP_DETECTION = True # Skip subtitle detection
- 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
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
MODE = InpaintMode.LAMA # Set to LAMA algorithm
LAMA_SUPER_FAST = False # Ensure quality
- CondaHTTPError
Place the .condarc file from the project in the user directory (C:/Users/<your_username>). If the file already exists in the user directory, overwrite it.
Solution: https://zhuanlan.zhihu.com/p/260034241
- 7z file extraction error
Solution: Upgrade the 7-zip extraction program to the latest version.
pip install torch==2.1.0 torchvision==0.16.0 --index-url https://download.pytorch.org/whl/cu118