English | 简体中文
KLing-Video-WatermarkRemover-Enhancer is an open-source tool designed specifically for processing videos generated by KLing. This tool integrates watermark removal and video enhancement features, making videos clearer and more professional, suitable for personal video optimization and batch video processing scenarios.
- Watermark Removal: Automatically detects and removes watermarks from KLing-generated videos, ensuring the video is clean.
- Video Enhancement: Enhances video clarity, brightness, and contrast through advanced algorithms, improving the viewing experience.
- Batch Processing: Supports processing multiple video files at once, efficiently managing large volumes of videos.
Follow these steps to install KLing-Video-WatermarkRemover-Enhancer:
git clone https://github.com/chenwr727/KLing-Video-WatermarkRemover-Enhancer.git
cd KLing-Video-WatermarkRemover-Enhancer
pip install -r requirements.txt
The configuration file config.yaml
defines the parameters for watermark removal.
This section configures the watermark removal parameters:
-
position: [556, 1233, 701, 1267]
- This specifies the area for watermark removal, typically defining the top-left and bottom-right coordinates of a rectangular region.
- The values represent
(x1, y1, x2, y2)
where(556, 1233)
is the top-left corner and(701, 1267)
is the bottom-right corner of the watermark.
-
ckpt_p: "./weights/sttn.pth"
- Path to the watermark removal model weight file.
- sttn.pth is a model based on the Spatio-Temporal Trajectory Network (STTN), commonly used for removing objects or watermarks from dynamic videos.
-
mask_expand: 30
- Expands the watermark area by a given number of pixels.
- Expanding the watermark region ensures no residue or artifacts are left around the edges after removal.
-
neighbor_stride: 10
- Controls the stride size when computing neighboring frames using the Spatio-Temporal Trajectory Network.
- A larger stride reduces computation but may affect the watermark removal quality.
This section configures the video enhancement parameters:
-
RealESRGAN_model_path: "./weights/RealESRGAN_x2plus.pth"
- This is the path to the Real-ESRGAN model weights, which are used to enhance the resolution and quality of the video.
- More information about the model can be found in Real-ESRGAN/inference_realesrgan.py.
- RealESRGAN_x2plus.pth
-
GFPGANer_model_path: "./weights/GFPGANv1.4.pth"
- This is the path to the GFPGAN model weights, which are used for face enhancement within the video, improving clarity and detail in facial features.
- More information about the model can be found in Real-ESRGAN/cog_predict.py.
- GFPGANv1.4.pth
To remove watermarks and enhance videos using KLing-Video-WatermarkRemover-Enhancer, simply run the following command:
python main.py --input path/to/video.mp4 --remove-watermark --enhance-video
--input
: Path to the input video or folder.--remove-watermark
: Enables the watermark removal function when specified.--enhance-video
: Enables video enhancement when specified.
python main.py --input example.mp4 --remove-watermark --enhance-video
- main.py: Main program entry point, responsible for managing the entire processing workflow.
- modules/: Contains functional modules (such as erasing watermarks, enhancing videos, and more).
- utils/: Contains general utilities such as logging, video processing tools, etc.
- config.yaml: Configuration file for setting watermark parameters.
- Video Erasure: https://github.com/researchmm/STTN
- Video Restoration: https://github.com/xinntao/Real-ESRGAN