Skip to content

Latest commit

 

History

History
executable file
·
220 lines (154 loc) · 8.71 KB

README_en.md

File metadata and controls

executable file
·
220 lines (154 loc) · 8.71 KB

简体中文 | English

Project Introduction

License python version support os

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):

For use only by users with Nvidia graphics cards (AMD graphics cards are not supported).

Demonstration

  • GUI:

demo2.gif

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

2. Create and activate a virtual environment

(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 is video-subtitle-remover, enter cd D:/tools/video-subtitle-remover-main.

(2) Create and activate the conda environment:

conda create -n videoEnv python=3.8
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:

      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

4. Run the program

  • Run the graphical interface
python gui.py
  • Run the command line version (CLI)
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:

MODE = InpaintMode.STTN  # Set to STTN algorithm
STTN_SKIP_DETECTION = True # Skip subtitle detection
  1. 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
  1. 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

  1. 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