A fast, reliable Python tool for removing logos and watermarks from videos by covering specific regions. Uses intelligent color sampling and blending for natural-looking results. Preserves audio and maintains high video quality.
- Region-based removal - Specify exact areas to cover (no ML detection needed)
- π Audio preservation - Keeps original audio intact
- π― High quality output - Near-lossless video encoding (CRF 18)
- Flexible coordinates - Use percentages (85%) or pixels (1100)
- Frame-specific timing - Control when each region is active
- Smart color sampling - Automatically matches surrounding colors
- Multiple methods - Color fill + blur or OpenCV inpainting
- Batch processing - Use config files for complex setups
- Preview mode - See regions before processing
- Progress tracking - Real-time progress bar
- Fast processing - No heavy ML models required
# Install system dependencies
sudo apt update
sudo apt install python3 python3-pip ffmpeg -y
# Install Python dependencies
pip3 install opencv-python numpy tqdm
# Or using requirements.txt
pip3 install -r requirements.txt# Check Python script
python3 remove_logo_regions.py --help
# Check FFmpeg
ffmpeg -versionRemove a logo from the bottom-right corner:
python3 remove_logo_regions.py \
-v input.mp4 \
-r "x=85%,y=90%,w=12%,h=6%" \
-o clean_video.mp4Remove multiple logos with different timing:
python3 remove_logo_regions.py \
-v input.mp4 \
-r "x=85%,y=90%,w=12%,h=6%,start=300,end=7320" \
-r "x=42%,y=12%,w=15%,h=6%,start=0,end=300" \
-o clean_video.mp4 \
--previewFor precise control, use pixel coordinates:
python3 remove_logo_regions.py \
-v input.mp4 \
-r "x=1100,y=650,w=150,h=50" \
-o clean_video.mp4Create config.json:
{
"regions": [
{
"x": "85%",
"y": "90%",
"w": "12%",
"h": "6%",
"start_frame": 0,
"end_frame": 7320
},
{
"x": "42%",
"y": "12%",
"w": "15%",
"h": "6%",
"start_frame": 0,
"end_frame": 100
}
],
"use_inpainting": false,
"blur_strength": 5
}Then run:
python3 remove_logo_regions.py -v input.mp4 -c config.json -o clean_video.mp4| Option | Short | Description |
|---|---|---|
--video |
-v |
Required. Input video file path |
--output |
-o |
Output video file (default: output.mp4) |
--region |
-r |
Region specification (can use multiple times) |
--config |
-c |
Load regions from JSON config file |
--inpaint |
-i |
Use OpenCV inpainting instead of color fill |
--blur |
-b |
Blur strength (odd number, default: 5) |
--margin |
-m |
Margin for color sampling (default: 15 pixels) |
--preview |
-p |
Preview regions before processing |
Regions use comma-separated key=value pairs:
x=VALUE,y=VALUE,w=VALUE,h=VALUE[,start=FRAME,end=FRAME]
Parameters:
x- X coordinate (left edge)y- Y coordinate (top edge)w- Widthh- Heightstart- Starting frame (optional, default: 0)end- Ending frame (optional, default: last frame)
Values can be:
- Percentages:
x=85%(85% from left edge) - Pixels:
x=1100(1100 pixels from left edge)
- Make an educated guess
- Use
--previewto see the region - Adjust and re-run until perfect
python3 remove_logo_regions.py -v input.mp4 -r "x=85%,y=90%,w=12%,h=6%" -p- Extract a frame:
ffmpeg -i input.mp4 -vframes 1 frame.png - Open in GIMP/Photoshop and note coordinates
- Use pixel values in the command
| Position | Suggested Region |
|---|---|
| Bottom-right | x=85%,y=90%,w=12%,h=6% |
| Bottom-left | x=3%,y=90%,w=12%,h=6% |
| Top-right | x=85%,y=3%,w=12%,h=6% |
| Top-left | x=3%,y=3%,w=12%,h=6% |
| Top-center | x=42%,y=3%,w=15%,h=6% |
python3 remove_logo_regions.py \
-v input.mp4 \
-r "x=85%,y=90%,w=12%,h=6%,start=500,end=7320" \
-o clean_video.mp4python3 remove_logo_regions.py \
-v input.mp4 \
-r "x=85%,y=90%,w=12%,h=6%" \
-r "x=10%,y=10%,w=8%,h=4%,start=0,end=200" \
-r "x=50%,y=50%,w=10%,h=5%,start=1000,end=2000" \
-o clean_video.mp4python3 remove_logo_regions.py \
-v input.mp4 \
-r "x=85%,y=90%,w=12%,h=6%" \
--inpaint \
-o clean_video.mp4python3 remove_logo_regions.py \
-v input.mp4 \
-r "x=85%,y=90%,w=12%,h=6%" \
--blur 9 \
-o clean_video.mp4The tool uses FFmpeg with high-quality encoding settings:
- CRF 18: Near visually lossless (lower = better quality, 0 = lossless, 51 = worst)
- Preset slow: Better compression efficiency
- Audio: 320k AAC (high quality)
To change quality settings, edit the _merge_audio_with_ffmpeg method in the script:
'-crf', '18', # Change to 15 for higher quality, 23 for smaller files
'-preset', 'slow', # Change to 'medium' for faster encoding
'-b:a', '320k', # Audio bitrateQuality vs File Size:
- CRF 15: Excellent quality, large files
- CRF 18: Near-lossless, recommended (default)
- CRF 23: Good quality, smaller files
- CRF 28: Lower quality, much smaller files
- Use percentages - They work across different resolutions
- Preview first - Always use
--previewto verify regions - Make regions slightly larger - Better to cover extra area
- Use blur - Default blur (5) works well, increase to 7 or 9 for better blending
- Try both methods - Color sampling is faster, inpainting is higher quality
- Ensure FFmpeg is installed - Required for audio and quality
- Speed: Processes 1080p video at 30-60 FPS on modern hardware (frame processing)
- Encoding: FFmpeg re-encoding adds ~1-2x video duration for final output
- Memory: Low memory usage (~500MB for 1080p)
- CPU only: No GPU required (but works faster with GPU-enabled OpenCV)
Problem: No audio in output video
- Solution: Install FFmpeg:
sudo apt install ffmpeg - Solution: Check that original video has audio:
ffprobe input.mp4
Problem: Poor video quality
- Solution: Install FFmpeg for high-quality encoding
- Solution: Lower CRF value in script (e.g., 15 instead of 18)
Problem: Visible edges around covered region
- Solution: Increase blur strength:
--blur 7or--blur 9 - Solution: Increase margin:
--margin 20
Problem: Wrong color used for covering
- Solution: Adjust margin to sample from different area
- Solution: Try inpainting method:
--inpaint
Problem: Logo not fully covered
- Solution: Make region slightly larger
Problem: Video not processing
- Solution: Check video path and permissions
- Solution: Ensure video codec is supported (MP4, AVI, MOV work best)
Problem: "FFmpeg not found" warning
- Solution: Install FFmpeg:
- Ubuntu/Debian:
sudo apt install ffmpeg - macOS:
brew install ffmpeg - Windows: Download from https://ffmpeg.org/download.html
- Ubuntu/Debian:
logo_remover/
βββ remove_logo_regions.py # Main script
βββ README.md # This file
βββ LICENSE # MIT License
βββ requirements.txt # Python dependencies
βββ config.json.example # Example config file
βββ examples/ # Example configs
βββ bottom_right.json
βββ multiple_regions.json
βββ timed_removal.json
- OS: Ubuntu 18.04+ (or any Linux distro with FFmpeg support)
- Python: 3.7 or higher
- FFmpeg: Required for audio and high quality
- RAM: 2GB minimum (4GB+ recommended for HD videos)
- CPU: Any modern CPU (faster = better)
- Disk: Enough space for temporary files and output (~2x input video size)
Contributions are welcome! Here's how:
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes
- Add tests if applicable
- Commit:
git commit -am 'Add feature' - Push:
git push origin feature-name - Submit a Pull Request
git clone https://github.com/yourusername/video-logo-remover.git
cd video-logo-remover
sudo apt install ffmpeg # Install FFmpeg
pip install -r requirements.txt- Follow PEP 8
- Add type hints
- Document functions with docstrings
- Keep functions focused and simple
MIT License - see LICENSE file for details.
Q: Can I remove animated logos?
A: Yes! As long as the logo stays in the same position, it will be covered.
Q: Will this work on 4K videos?
A: Yes, but processing will be slower. Consider using percentages for coordinates.
Q: Does the audio get preserved?
A: Yes! FFmpeg automatically copies audio from the original video at high quality (320k AAC).
Q: What if I don't have FFmpeg?
A: The tool will still work but without audio and with reduced video quality. Install FFmpeg for best results.
Q: Can I use this on live streams?
A: This tool is designed for video files. For live streams, you'd need real-time processing.
Q: Does this work with all video formats?
A: It works with most formats OpenCV supports (MP4, AVI, MOV, MKV, etc.).
Q: How do I convert frame numbers to timestamps?
A: Frame number = timestamp (seconds) Γ FPS. Example: At 30 FPS, frame 300 = 10 seconds.
Q: Will the video quality be reduced?
A: No! With FFmpeg installed, the output uses CRF 18 (near visually lossless) encoding, maintaining excellent quality.
Q: Can I automate this for multiple videos?
A: Yes! Use a bash script:
#!/bin/bash
for video in *.mp4; do
python3 remove_logo_regions.py -v "$video" -c config.json -o "clean_${video}"
doneQ: How large will the output file be?
A: With CRF 18, output files are typically 80-120% of the original size. You can reduce this by using CRF 23 in the script.
- Issues: Report bugs on GitHub Issues
- Questions: Open a GitHub Discussion
- Email: yusuf@seitrascale.com
- OpenCV for video processing
- FFmpeg for high-quality encoding and audio handling
- tqdm for progress bars
- The open source community
- β¨ Audio preservation using FFmpeg
- β¨ High-quality encoding with CRF 18
- β¨ Automatic audio merging
- β¨ Better quality output with H.264 encoding
β οΈ FFmpeg now required for best results
- Initial release
- Region-based logo removal
- Percentage and pixel coordinate support
- Frame-specific timing
- Config file support
- Preview mode
- Two removal methods (color sampling + inpainting)
Made with β€οΈ for the open source community
Star β this repo if you find it useful!