lxulxu/WatermarkRemover
批量去除视频中位置固定的水印
WatermarkRemover
What it does: A tool that removes fixed watermarks from videos in batches, powered by the LAMA model.
Requirements
- Python 3.10 (exact version required)
Installation
- Clone the repository and enter the folder.
- (Optional but recommended) Create and activate a Python virtual environment.
- Install base dependencies with
pip install -r requirements.txt. - Install PyTorch — choose one of two options:
- CPU version:
pip install torch - GPU version (needs NVIDIA graphics card):
- Install CUDA Toolkit from NVIDIA's download page.
- Install cuDNN matching your CUDA version.
- Install the GPU build of PyTorch using the command from PyTorch's official site (e.g.,
pip3 install torch==2.6.0+cu126 ...).
- CPU version:
The program automatically detects whether a GPU is available and picks the processing mode accordingly.
Usage
Run from the command line:
python watermark_remover.py --input /path/to/videos --output /path/to/output
Add --preview to see the effect before processing.
Command-line options
| Parameter | Short | Description | Default |
|---|---|---|---|
--input |
-i |
Folder containing video files | . (current folder) |
--output |
-o |
Folder for processed videos | output |
--preview |
-p |
Show effect preview before processing | Disabled |
How it works
- Select the watermark area: The program shows one frame of the video. You manually draw a box around the watermark, then press SPACE or ENTER to continue.
- Preview (optional): If enabled, shows the processed result. Press SPACE or ENTER to confirm, or ESC to cancel and exit.
- Process the video: The first run downloads the LAMA model, which takes a while.
- Output: Results are saved as MP4 files.
Limitations
- Only works on watermarks that stay in a fixed position — moving watermarks are not supported.
- All videos processed in one batch must have the same dimensions.
- All videos in one batch must have the same watermark.
Troubleshooting GPU issues
If you see No GPU detected, using CPU for processing, the README suggests:
- Check that Python is 3.10.
- Verify you installed the GPU version of PyTorch, not the CPU one (the README quotes Lama Cleaner's docs: if the tool isn't using the GPU, a CPU-only PyTorch is likely installed).
- Make sure your CUDA, cuDNN, and PyTorch versions are compatible with your graphics card:
- Check NVIDIA's CUDA compatibility list for your GPU.
- Pick a matching cuDNN version from NVIDIA's archive.
- Pick the matching PyTorch build from PyTorch's site.
When the GPU is detected correctly, the program prints something like GPU detected: NVIDIA XXX Using GPU for processing.
Star history
The README includes a star-history chart showing the project's GitHub stars over time.
Related
- Project
- Project
- Project
- Project