title: Free Profanity Filter for Movies & Videos
emoji: “🎬”
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: “6.0.0”
app_file: app.py
pinned: false
tags:
- profanity-filter
- video-filter
- family-friendly
- movie-cleaner
- content-filter
- parental-controls
- netflix-filter
- open-source
- local-processing
- privacy
license: mit
Try the Online Demo
Want to see how it works before installing? Try the app instantly in your browser:

Free Profanity Filter for Movies & Videos
Created by Adeel Raza · Contact: [email protected]
This tool cleans profanity and swear words out of video files you already
have. It finds spoken offensive language with AI, then either cuts those
moments out or mutes them in place, and writes a cleaned video plus a
cleaned subtitle file.
What it does
- Detects mainly profanity and swear words (editable word list; optional
stricter lists available)
- Removes matched speech by cutting the timeline, or keeps the timeline and
mutes those intervals with
--mute-only (typically ~2× faster video
processing because the video stream is copied instead of re-encoded)
- Outputs a cleaned video and a cleaned
.srt subtitle file
- Works much faster when you provide (or auto-detect) an existing subtitle file
alongside the video
- Includes a Gradio web UI (upload a video in the browser) as well as a CLI
- Runs entirely on your computer—no cloud upload and no account required
- Supports optional GPU acceleration for Whisper: NVIDIA CUDA (default,
production-tested path) and optional Intel Arc / iGPU via OpenVINO
(beta — see below; install
requirements-intel.txt)
Who it is for
Families, educators, and anyone who wants a cleaner cut of movies or clips
without a monthly subscription or streaming lock-in.
Quick Start — clean your files for profanity words
Install once (see Setup below), then clean a video:
python3 clean.py YourMovie.mp4 YourMovie_cleaned.mp4
That writes a cleaned video and a cleaned .srt subtitle file.
Faster (if you already have subtitles):
python3 clean.py YourMovie.mp4 YourMovie_cleaned.mp4 --subs YourMovie.srt
Matching .srt / .vtt files next to the video (same name) are auto-detected.
Mute instead of cut (keeps full runtime; usually faster encode):
python3 clean.py YourMovie.mp4 YourMovie_cleaned.mp4 --mute-only
YouTube download + clean:
yt-dlp -o "video.mp4" "https://www.youtube.com/watch?v=VIDEO_ID"
python3 clean.py video.mp4 video_cleaned.mp4
More flags: Usage and Command Line Options.
Gradio web UI (GUI)
Prefer a browser over the command line? The project ships a Gradio GUI. Upload a
video, optionally add subtitles, pick a Whisper model (tiny → large), and
click Clean Video.

Try online (no install): use the Hugging Face Spaces demo.
Run locally after Setup:
python3 app.py
# then open http://127.0.0.1:7860
Or with Docker:
docker compose up --build web
# open http://localhost:7860
NVIDIA GPU Docker UI: docker compose --profile gpu up --build web-gpu (needs
NVIDIA Container Toolkit). Default Whisper model in the UI is base; choose
large for fewer missed swear words (slower, more RAM).
Setup
Follow these steps first so you can run the tool right away.
Prerequisites (install these first)
The Python requirements file cannot install system programs such as FFmpeg. Before
cloning the repository, install:
- Python 3.8+, including
pip and virtual-environment support
- FFmpeg and FFprobe (FFprobe is normally included with FFmpeg)
- Git
- An NVIDIA CUDA setup is optional; the app automatically uses a CUDA GPU
when CTranslate2 can detect one and otherwise falls back to CPU
Ubuntu / Debian
sudo apt update
sudo apt install -y git python3 python3-pip python3-venv ffmpeg
Fedora
sudo dnf install -y git python3 python3-pip ffmpeg
macOS (Homebrew)
brew install git python ffmpeg
Windows
- Install Python 3 and enable
Add Python to PATH during setup.
- Install Git for Windows.
- Install FFmpeg with
winget install Gyan.FFmpeg, or download it from
ffmpeg.org and add its bin folder to
PATH.
Verify the prerequisites before continuing:
python3 --version # On Windows, use: python --version
ffmpeg -version
ffprobe -version
git --version
Default install is CPU-only. CUDA / cuDNN are not required for normal use.
Quick Setup (Copy & Paste)
# Step 1: Clone the repository
git clone https://github.com/adeel-raza/profanity-filter.git
cd profanity-filter
# Step 2: Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Step 3: Install dependencies (takes 2-5 minutes)
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
# Step 4: Confirm the command is ready
python3 clean.py --help
On Windows, activate with venv\Scripts\activate and replace python3 with
python in the commands above.
Ubuntu/Debian shortcut: ./install.sh performs the system check, creates
the virtual environment, and installs the Python requirements. The manual
steps above are recommended on other operating systems.
Docker (no local Python setup)
One Dockerfile provides two build targets:
| Target |
When to use |
Build |
cpu (default) |
Most users / no NVIDIA GPU |
docker build -t profanity-filter:cpu --target cpu . |
gpu |
NVIDIA GPU + NVIDIA Container Toolkit |
docker build -t profanity-filter:gpu --target gpu . |
Clean a video (CPU):
docker build -t profanity-filter:cpu --target cpu .
docker run --rm \
-v "$PWD":/data \
-v profanity-hf-cache:/cache \
profanity-filter:cpu \
/app/clean.py /data/input.mp4 /data/output.mp4
Clean a video (GPU):
docker build -t profanity-filter:gpu --target gpu .
docker run --rm --gpus all \
-v "$PWD":/data \
-v profanity-hf-cache:/cache \
profanity-filter:gpu \
/app/clean.py /data/input.mp4 /data/output.mp4
Gradio web UI (see Gradio web UI (GUI) for screenshot and
Whisper model picker):
# CPU
docker run --rm -p 7860:7860 -v "$PWD":/data -v profanity-hf-cache:/cache \
profanity-filter:cpu /app/app.py
# GPU (NVIDIA)
docker run --rm --gpus all -p 7860:7860 -v "$PWD":/data -v profanity-hf-cache:/cache \
profanity-filter:gpu /app/app.py
Or with Compose:
docker compose up --build web # CPU UI
docker compose --profile gpu up --build web-gpu # NVIDIA GPU UI
Notes:
- Mount your videos into
/data (container working directory).
- The
/cache volume stores downloaded Whisper models so they are not re-fetched every run.
- Force CPU inside any image with
-e PROFANITY_FILTER_DEVICE=cpu.
- The GPU image still falls back to CPU if no GPU is available at runtime.
Optional GPU acceleration
The app automatically accelerates both major processing stages when compatible
hardware is available:
- AI transcription (default): NVIDIA CUDA through faster-whisper / CTranslate2
- AI transcription (optional Intel): OpenVINO GenAI on Intel Arc / iGPU
- Video encoding: NVIDIA NVENC, Intel Quick Sync, AMD AMF, or Apple
VideoToolbox through FFmpeg
- If a compatible device, driver, runtime, or encoder is unavailable, that
stage safely falls back to CPU
- Pascal GPUs such as the Quadro P2000 use
int8 (then float32) rather than
unsupported/slow float16
Intel Arc / iGPU Whisper (optional, beta)
Beta / untested on real Arc hardware: This path was added from OpenVINO
GenAI docs and public Arc/OpenVINO Whisper examples. It has not been
validated end-to-end on an Intel Arc card (for example B580) in this project
yet. Treat it as experimental: if it fails, the app should fall back to CPU
faster-whisper, or you can force PROFANITY_FILTER_DEVICE=cpu. Bug reports
from Arc users are welcome.
faster-whisper cannot use Intel GPUs. For Arc (for example B580) or Intel iGPU
transcription, install the optional extras only on Intel GPU machines:
python3 -m pip install -r requirements-intel.txt
Behavior:
- Cheap hardware probe (PCI / sysfs / Windows video controller) looks for Intel GPU
- Only then OpenVINO packages are imported
- If OpenVINO sees a
GPU device, Whisper runs there; otherwise CPU faster-whisper
- Machines without an Intel GPU never import OpenVINO
Overrides:
PROFANITY_FILTER_DEVICE=openvino # force OpenVINO attempt (beta)
PROFANITY_FILTER_DEVICE=cpu # force CPU
PROFANITY_FILTER_DEVICE=cuda # force NVIDIA path
Auto order: CUDA → OpenVINO (Intel hint only, beta) → CPU. First OpenVINO run
downloads a converted Whisper model from Hugging Face into the cache. In Docker,
the container also needs access to the Intel device (typically /dev/dri).
Recommendation: Prefer a GPU machine when available. In our controlled
side-by-side tests, GPU was better for:
- Speed— faster Whisper transcription and much faster video rebuild
- Encode quality— higher SSIM/PSNR vs the source after cutting
CPU still works fully via automatic fallback. Before VAD tuning, one CPU test
stretched a word across silence and over-cut clean audio. Current builds use a
tuned VAD threshold and clamp overstretched single-word spans. In the current
three-clip validation, CPU and GPU both detected and removed all three known
profanities with closely matching boundaries. Do not interpret the small test
set as proof that either device is always more accurate.
Install a current NVIDIA driver and the CUDA/cuDNN runtime versions required by
your installed CTranslate2 release. Then verify detection:
nvidia-smi
python3 -c "import ctranslate2; print('CUDA devices:', ctranslate2.get_cuda_device_count())"
When processing starts, the log reports the selected device and compute type.
It also reports the selected video encoder. For troubleshooting only, force
CPU processing with:
PROFANITY_FILTER_DEVICE=cpu python3 clean.py input.mp4 output.mp4
PROFANITY_FILTER_DEVICE=openvino python3 clean.py input.mp4 output.mp4
PROFANITY_FILTER_VIDEO_ENCODER=cpu python3 clean.py input.mp4 output.mp4
To request a specific FFmpeg hardware encoder:
PROFANITY_FILTER_VIDEO_ENCODER=h264_nvenc python3 clean.py input.mp4 output.mp4
Requested hardware still falls back safely to CPU if initialization or the
actual movie encode fails.
Verified CPU vs GPU benchmark (same 12s clip)
Measured with the same source file (12.012s, 1918x802, SHA-256
e0848fc3…) on a CPU-only laptop vs a Quadro P2000 server.
| Stage |
Laptop (no NVIDIA GPU) |
Home server (Quadro P2000) |
| Whisper device |
CPU int8 |
CUDA int8 |
| Video encoder |
CPU libx264 |
NVIDIA h264_nvenc |
Full clean.py wall clock |
16.14s |
10.30s (~1.6x faster) |
| Transcription |
1.0s (12.6x realtime) |
0.5s (22.6x realtime) |
Identical cut encode (2.15–5.37s removed) |
8.97s |
2.46s (~3.6x faster) |
| Quality vs source (SSIM All, first 2s keep) |
0.9948 |
0.9967 |
| Quality vs source (PSNR avg, first 2s keep) |
52.1 dB |
54.4 dB |
| Cleaned file size (identical cut) |
3.7 MB (~3.3 Mbps) |
6.3 MB (~5.8 Mbps) |
| Peak NVENC utilization |
n/a |
100% |
| Detected cut for a single swear word (before CPU VAD fix) |
2.15–5.37 (3.22s, over-cut) |
4.83–5.37 (0.54s, accurate) |
Notes for users:
- GPU is the better path when available for speed and encode fidelity.
- The identical-cut encode row is the fair encoder comparison (same remove
timestamps on both machines).
- CPU fallback remains supported. Newer builds add Whisper
vad_filter plus a
1.0s single-word span clamp so CPU is less likely to stretch a word across
silence and delete clean audio.
- Some CPU work remains even on GPU machines (audio + FFmpeg timeline filters).
Realistic CPU vs GPU comparison (after all tests)
After the single-clip encode test, the three-clip VAD validation, and the
six-clip context validation on the same laptop vs Quadro P2000 pair, this is the
honest practical picture:
| What users care about |
CPU-only laptop |
Quadro P2000 GPU |
Realistic takeaway |
| Hard-profanity detection |
Passed all known targets in the tuned tests |
Passed all known targets |
Both are usable for detection after VAD tuning |
| Ambiguous false positives (ordinary phrases / common name) |
Correctly left alone |
Correctly left alone |
Context rules work the same on both devices |
| Cut timing after VAD tuning |
Matched known captions closely |
Matched known captions closely |
GPU is not clearly “more accurate” on the current samples |
| Transcription speed |
~1.0–1.1s on 12s clips |
~0.5–0.6s on the same clips |
GPU is about 2x faster at Whisper |
| Video rebuild after a cut |
~9–15s on short clips |
~2.5–3.0s on the same clips |
GPU encoding is about 3.5–5x faster |
| Visual fidelity after cutting |
SSIM ~0.993–0.995 / PSNR ~50–52 dB |
SSIM ~0.997–0.998 / PSNR ~54–56 dB |
GPU outputs measured closer to the source |
| Output file size after cutting |
Smaller |
Larger (~30–70% in these tests) |
GPU quality settings favor fidelity over size |
| Full job with real cuts |
Mean ~20.5s on three 12s clips |
Mean ~8.5s on the same clips |
GPU is about 2.4x faster end-to-end |
| Jobs with no cuts (copy-through) |
Can finish sooner on short clips |
May look slower because of CUDA startup |
GPU advantage appears when the app actually re-encodes |
Bottom line for users:
- Prefer a GPU machine when you have one. The realistic gains are speed and
encode quality, not a proven detection-accuracy monopoly.
- CPU remains a complete fallback. Current builds keep CPU cut timing much
closer to GPU by using Whisper VAD plus a 1.0s single-word span clamp.
- The biggest GPU win is the cut/rebuild stage (
h264_nvenc vs libx264).
Transcription is faster too, but encoding usually dominates wall time.
- Short no-cut clips can hide the GPU advantage because each run still pays
model/device startup cost. Longer movies with real removals are where GPU
savings compound.
- Expect GPU cleaned files to be somewhat larger when quality settings are
held high. That is a fidelity tradeoff, not a failure.
These conclusions come from controlled short clips with matched source hashes.
Absolute times will change with movie length, resolution, bitrate, Whisper
model size, and hardware, but the relative pattern above is what we repeatedly
measured.
Before/After Example
GitHub and Hugging Face READMEs do not play in-page video players reliably, so
the demos are linked below (open in a new tab).
Real-World Clip
Longer Sample (Vimeo)
Typical result on that clip: about 19 segments / ~13.5 seconds of
profanity removed, with audio-video sync preserved.
Support This Project
If you find this project helpful, please consider supporting it: 
Table of Contents
Why Choose This Free Profanity Filter?
Free and open source
No subscription. Process your own files once and watch them offline as often as
you like.
Works with your files
- Local video files (MP4, MKV, AVI, and similar)
- YouTube downloads (via yt-dlp)
- DVDs and Blu-rays ripped to digital files
- Any source you can save as a normal video file
Privacy and control
- Everything runs on your computer
- No cloud upload required for filtering
- You choose the word list and how aggressively to filter
How It Works - The Technology Behind 95%+ Accuracy
1. Dialog Enhancement (Audio Preprocessing)
- Vocal isolation: High-pass (200Hz) and low-pass (3500Hz) filters remove music, effects, and noise
- Dynamic normalization: Balances quiet dialogue and loud scenes for consistent transcription
- Result: 4-5x more words transcribed in complex audio (music, action scenes, background noise)
- Example: Original tiny model caught 0 profanities in Argo → Enhanced base model caught 38 segments
2. AI Audio Transcription (Word-Level Precision)
- Uses faster-whisper base model (74M parameters) for superior accuracy on movies
- Dialog-enhanced audio helps model “hear” speech masked by soundtracks
- Each word gets a precise timestamp (accurate to 0.1 seconds)
- Example: a flagged word at 79.76s-80.08s, the next word at 80.08s-80.88s
- Unlike subtitle-based filters that cut entire sentences, this tool can cut only the matched words.
- Tiny model is available for faster processing, but is less accurate and may miss profanity, especially in movies with music or background noise.
3. Smart Multi-Word Detection (Phrase Recognition)
- Automatically detects 1,000+ entries from the editable word list (including common variations)
- Intelligent merging: Combines split multi-word phrases into single cuts
- Context-aware: Uses a short time window to catch phrases spoken together
- Whole-word matching: Avoids matching clean words that only contain a partial letter pattern
- Quality monitoring: WPM (words per minute) diagnostic warns if transcription incomplete
4. Frame-Accurate Video Cutting
- FFmpeg-powered editing: Industry-standard video processing tool
- Surgical precision: Removes only profanity segments (typically 0.3-2 seconds each)
- Quality preservation: Original video bitrate, resolution, and encoding maintained
- Smooth transitions: Seamless cuts without audio glitches or visual artifacts
Result: 95%+ Profanity-Free Videos
Detection covers spoken content only (transcription + word list). Non-verbal sounds without spoken words are not classified.
- 38 segments detected in Argo (129-minute movie with orchestral score)
- 0.46 minutes removed (99.6% of content preserved)
- Improvement: Tiny model missed 100% of profanity → Enhanced base caught all instances
- Manual review option: Add timestamps with
--remove-timestamps for any missed words
CPU-Intensive Task Warning
Important: Video cleaning is a CPU-intensive task on CPU-only systems.
On systems like the 11th Gen Intel® Core™ i5-1135G7 ×8 without a working
hardware encoder:
- Processing a 2-hour movie can take ~6 hours
- Do not run other heavy applications (games, video editing, compiling) simultaneously
- Video encoding, decoding, and profanity removal require sustained high CPU usage
- Ensure enough RAM and disk space is available to avoid slowdowns or failures
Tip: With a compatible GPU, the app automatically moves transcription and/or
video encoding to hardware. Existing subtitles (--subs) can also reduce
transcription work.
System Requirements
Important: Resource Usage Warning
On CPU-only systems, this application is CPU and memory intensive.
Hardware-enabled systems automatically use a validated GPU video encoder:
- CPU Usage: Expect 80-100% only when hardware acceleration is unavailable
- RAM Requirements: 8GB minimum (16GB recommended for base model)
- Disk I/O: Heavy read/write operations during video processing
- Processing Time: 3-6 hours for a 2-hour movie on CPU (base model with dialog enhancement)
Optional GPU speedup: An NVIDIA GPU can make transcription much faster, but it is not required. The default path runs on CPU.
NVIDIA CUDA accelerates transcription, while NVENC, Quick Sync, AMF, or VideoToolbox can accelerate the quality video rebuild. Some CPU remains necessary for FFmpeg timeline filters, audio processing, and application coordination.
Best Practice: On CPU-only machines, run overnight or when you don’t need your computer. Using existing subtitle files (--subs) is the fastest way to skip long transcription.
Minimum Specs (Budget PCs)
- CPU: Quad-core processor (Intel i5, AMD Ryzen 5, or better)
- RAM: 8GB minimum (base model)
- Storage: 5GB free space + 2x video file size
- OS: Windows 10/11, macOS 10.15+, or Linux
- Processing Time: 2-hour movie takes ~6 hours on CPU
- CUDA/cuDNN: Not required
- Warning: Expect very long processing times without GPU
Recommended Specs (Production Use)
- CPU: Multi-core processor (Intel i7/i9, AMD Ryzen 7/9)
- RAM: 16GB or more
- GPU (optional): NVIDIA GPU with CUDA 12 support (GTX 1060 or better)
- Storage: 10GB+ free space
- Processing Time: ~20-40 minutes with GPU, much longer on CPU
Optional GPU Acceleration (Windows / NVIDIA)
CUDA 12 and cuDNN 9 are optional. Use them only if you want NVIDIA GPU acceleration on Windows.
- Install a recent NVIDIA Game Ready / Studio driver
- Install CUDA Toolkit 12.x from NVIDIA
- Install cuDNN 9 matching your CUDA 12.x version
- Reinstall/upgrade the CUDA-enabled CTranslate2 / faster-whisper stack in your venv:
pip install -U faster-whisper
- Verify GPU visibility:
nvidia-smi
python3 -c "import ctranslate2; print(ctranslate2.get_cuda_device_count())"
If CUDA/cuDNN are missing or mismatched, the tool automatically falls back to CPU with a clear warning instead of crashing.
With compatible transcription/video-encoding hardware:
- Processing Time: 2-hour movie in ~5-10 minutes
- CPU Load: Significantly reduced; exact usage depends on FFmpeg filters
- System Usability: Computer remains responsive during processing
- Cost: Free to use, but requires compatible hardware
Note: This tool processes videos locally, so runtime depends on your hardware. Process a file once, then watch the cleaned copy as often as you like.
Usage - Simple Command Line
Basic Usage (Recommended - Auto-Enhanced)
# Simple command - dialog enhancement and auto-upgrade enabled by default
python3 clean.py input_video.mp4 output_cleaned.mp4
That’s it! The tool now uses optimal settings by default:
- Base model (better accuracy than tiny)
- Dialog enhancement (isolates speech from music/noise)
- Auto-upgrade (switches to larger model if needed)
- Quality monitoring (warns if transcription incomplete)
Advanced Options
# Disable dialog enhancement (not recommended)
python3 clean.py input.mp4 output.mp4 --no-dialog-enhance
# Use different model
python3 clean.py input.mp4 output.mp4 --model small # or medium, large
# Save transcript for review
python3 clean.py input.mp4 output.mp4 --dump-transcript transcript.txt
# Disable auto-upgrade
python3 clean.py input.mp4 output.mp4 --no-auto-upgrade
# Add manual timestamps
python3 clean.py input.mp4 output.mp4 --remove-timestamps "45.2-47.8,120-125"
What Changed (v2.0 - Enhanced Detection)
Old defaults (missed profanity):
- Tiny model (39M parameters)
- No audio preprocessing
- Failed on movies with soundtracks
New defaults (much stronger detection):
- Base model (74M parameters) - 2x more accurate
- Dialog enhancement enabled - isolates speech
- Auto-upgrade if WPM low - catches edge cases
- 1,000+ entries in the default word list
Result: 0% → 95%+ detection on complex audio
Why faster-whisper?
This tool uses faster-whisper instead of standard OpenAI Whisper for significant performance improvements:
- 4-10x faster transcription: 15 seconds vs 25 seconds for a 3-minute video
- Same accuracy: CTranslate2 backend provides identical transcription quality
- Lower memory usage: Optimized int8 quantization for efficient CPU processing
- Word-level timestamps: Precise profanity detection and removal
Example performance (3-minute video, CPU):
- Transcription: ~15 seconds (12.3x real-time)
- Total processing: ~1 minute 40 seconds including video cutting
How It Works - Technical Deep Dive
The 4-Step Profanity Removal Process
Step 1: AI Audio Transcription with Dialog Enhancement
- Technology: faster-whisper (OpenAI Whisper optimized with CTranslate2)
- Dialog Enhancement: FFmpeg audio filtering isolates speech (200-3500Hz vocal range, removes music/effects)
- Process: Converts speech to text with word-level timestamps (±0.1s accuracy)
- Quality Monitoring: Calculates Words Per Minute (WPM); warns if <50 (indicates under-transcription)
- Auto-Upgrade: Automatically retries with larger model if transcription quality too low
- Example Output:
[79.76s-80.08s] "<flagged-word>"
[80.08s-80.88s] "<next-word>"
[82.15s-82.67s] "<flagged-word>"
- Why accurate: Trained on 680,000 hours of multilingual speech data
- Speed: Processes at 10-12x real-time speed on modern CPUs
Step 2: Word-List Matching
- Database: Editable CSV with 1,000+ default entries (plus optional soft list)
- Matching: Whole-word exact matching (helps prevent false positives)
- Scope: Filters spoken words/phrases that appear in the transcript and
match the word list—not separate audio-event / sound classification
Step 3: Intelligent Phrase Merging
- Problem: AI sometimes splits a multi-word phrase across separate detections
- Solution: Automatically merges nearby detections into a single cut
- Result: More natural speech flow, fewer awkward gaps
Step 4: Frame-Accurate Video Cutting
- Tool: FFmpeg (Hollywood-grade video processing)
- Precision: Cuts at exact keyframes (±0.1 second accuracy)
- Method:
- Extract clean segments between profanity
- Concatenate segments seamlessly
- Re-encode with original quality settings
- Smart encoding: Matches original bitrate, resolution, codec automatically
Step 5: Subtitle Synchronization
- Automatic adjustment: Shifts all subtitle timestamps after each cut
- Text cleaning: Removes profanity from subtitle text
- Format support: SRT and VTT formats
- Sync accuracy: ±0.1 second perfect lip-sync maintained
Why 95%+ Accuracy?
- Dialog enhancement (isolates speech from music/effects)
- Base model default (74M parameters, 2x more accurate than tiny)
- Auto-upgrade mechanism (switches to larger model if WPM low)
- Word-level timestamps (not sentence-level like competitors)
- 1,000+ word database (editable CSV; optional soft list available)
- Intelligent phrase merging (catches split expressions)
- Context-aware detection (whole-word matching)
- Frame-accurate cutting (surgical precision)
Real-world example (Argo 2012 film):
- Old version (tiny model, no enhancement): 0 detections (missed 100%)
- New version (base + dialog enhancement): 38 segments detected, 0.46 min removed
Edge Cases (That 5%)
- Heavy accents or unclear audio may be misheard by AI
- Creative slang or new profanity not in database
- Background noise masking quiet curse words
- Non-verbal sounds are not detected—only spoken words that appear in the transcript
- Solution: Use
--remove-timestamps to manually add missed segments; edit profanity_words.csv for custom spoken terms
Processing Time & Resource Usage
Expected Processing Times
Short Videos (5-15 minutes)
- Budget CPU: 2-5 minutes processing
- Modern CPU: 1-3 minutes processing
- With GPU: 30-60 seconds processing
- RAM Usage: 2-3GB during processing
Full Movies (90-120 minutes)
- CPU (base model + dialog enhancement): 3-5 hours processing
- With NVIDIA GPU (recommended): 15-30 minutes processing
- RAM Usage: 8GB minimum (16GB recommended)
- Disk Space: Temporary files need ~2x video size
Long Movies/Content (2-3 hours)
- CPU (base model + dialog enhancement): 6-10 hours processing
- With NVIDIA GPU (recommended): 20-40 minutes processing
System Resource Usage
- CPU-only: High utilization during transcription and H.264 encoding
- GPU-enabled: GPU handles supported AI transcription and video encoding;
CPU still handles audio and timeline filters
- RAM: 3-6GB depending on video length
- Disk I/O: Moderate (reading/writing video files)
- Temp Storage: Requires 2-3x the video file size temporarily
Tips for Faster Processing
- GPU acceleration (10-20x faster) - rent AWS/Google Cloud GPU instance for batch jobs
- Use
--subs flag if you have accurate subtitle files (skips transcription, 20x faster)
--mute-only for faster Step 3 on long files: copies the video stream and
only re-encodes audio (no timeline cuts). On a ~53-minute GPU run this was
~167 s mute vs ~347 s cut (~2× faster for the video step). Runtime length
stays the same; detected swears become silent gaps instead of removed segments.
- Close other heavy applications during processing
- Consider
--model tiny for speed (but may miss profanity on complex audio)
- Run overnight or during off-hours - quality over speed recommended
Command Line Options
python3 clean.py [input] [output] [options]
Arguments:
input Input video file path
output Output video file path
Options:
--subs FILE Use subtitle file (SRT/VTT). Auto-detects matching .srt/.vtt if omitted.
--srt-window FLOAT Limit subtitle-cue removal window when using --use-subs-detection.
--pad FLOAT Extra seconds before/after subtitle cues in subtitle-driven detection.
--merge-gap FLOAT Max gap between detected segments to merge (default: 0.06).
--expand-pad FLOAT Expand each detected segment before cutting/muting.
--model SIZE Whisper model: tiny, base, small, medium, large.
--force-audio Force audio-based detection (default behavior).
--use-subs-detection Use subtitles for detection instead of audio (advanced).
--phrase-gap FLOAT Max gap to merge consecutive profanity words into phrase segments.
--remove-timestamps Manually add timestamps: "start-end,start-end".
--mute-only Mute profanity intervals instead of cutting (faster: video copy + audio re-encode).
--include-religious Also filter religious/exclamatory terms (off by default).
--dump-transcript FILE Save raw transcript words with timestamps.
--dialog-enhance Enable dialog enhancement (default: enabled).
--no-dialog-enhance Disable dialog enhancement.
--min-wpm FLOAT Warn if words/minute is below threshold (default: 50.0).
--auto-upgrade-model Retry once with larger model if transcript quality is low.
--no-auto-upgrade Disable automatic model upgrade.
--hybrid Subtitle-first + selective audio detection (requires subtitles).
Output Files
- Cleaned Video:
[input]_cleaned.mp4 - Video with profanity segments removed
- Cleaned Subtitles:
[input]_cleaned.srt - Subtitles with profanity filtered and timestamps adjusted
Customize Filtered Words (CSV)
Edit profanity_words.csv to add or remove words the tool should filter.
Open it in any text editor or spreadsheet, save your changes, and they take
effect the next time you run clean.py or restart the Gradio app.
- Open
profanity_words.csv.
- Words and phrases are separated by commas and may span multiple lines.
- Delete any word you never want filtered.
- Add new words or phrases in lowercase, separated by commas.
- Prefix a token with
# to treat it as a comment (that entry is ignored).
- Save the file, then run
clean.py again (or restart the Gradio app).
Example:
word-one,word-two,phrase one
another-term
# notes-or-disabled-entry
Whitespace and duplicate entries are ignored. An empty CSV disables the default
word list. If the CSV is missing or cannot be read, the app falls back to its
built-in defaults.
Religious / exclamatory terms are off by default. Include them with:
python3 clean.py input.mp4 output.mp4 --include-religious
Clear matches from your word list are always filtered. A small set of
context-sensitive words uses nearby-dialogue rules so ordinary, non-offensive
phrases are less likely to be muted. Edit the CSV if you prefer stricter or
looser filtering.
Optional soft / romance vocabulary
The default profanity_words.csv focuses on clearly offensive language, so
ordinary dialogue is less likely to be muted.
Softer, common-dialogue words that often appear in normal conversation live in
a separate opt-in file:
profanity_words_optional_soft.csv
They are not loaded by default. For stricter scene or romance filtering,
merge that file into profanity_words.csv (or append its entries).
Frequently Asked Questions
Is this really free?
Yes. It is free and open source, with no subscription required.
Do I need Netflix or Amazon Prime?
No. It works with any video file you can save locally—downloads, rips, or files you already have.
How long does processing take?
A 2-hour movie typically takes about 6–10 hours on CPU (base model with dialog enhancement) or about 20–40 minutes with a compatible GPU. Process once, then watch offline as often as you like. GPU rental can help for batch jobs.
Will it work on my computer?
If you can run Python, yes. It works on Windows, macOS, and Linux. Minimum: 4GB RAM and a dual-core CPU.
Is my privacy protected?
Yes. Everything runs locally on your computer—no cloud uploads, tracking, or data collection.
Can I use this for YouTube videos?
Yes. Download with yt-dlp, then clean the video.
Does it remove all profanity?
It matches transcribed speech against an editable word list (1,000+ default
entries) using the base model + dialog enhancement. Accuracy is high on clear
dialogue; some edge cases may still need manual review.
Can I customize what gets filtered?
Yes. Edit profanity_words.csv to add, remove, or comment out words (prefix a
token with # to ignore it). Changes apply on the next run. Use
--include-religious for the optional religious/exclamatory list. For
stricter romance/scene filtering, merge entries from
profanity_words_optional_soft.csv. See
Customize Filtered Words (CSV).
Troubleshooting
“faster-whisper not installed”
pip install faster-whisper
“FFmpeg not found”
Install FFmpeg:
- Ubuntu/Debian:
sudo apt update && sudo apt install -y ffmpeg
- Fedora:
sudo dnf install -y ffmpeg
- macOS:
brew install ffmpeg
- Windows:
winget install Gyan.FFmpeg
Close and reopen the terminal after installation, then verify both binaries:
ffmpeg -version
ffprobe -version
Slow transcription (6+ hours for movies)
- Expected: Base model with dialog enhancement takes 3-6 hours per 2-hour movie on CPU
- Optional GPU acceleration: On Windows NVIDIA systems, install CUDA Toolkit 12.x + cuDNN 9 (see Optional GPU section above). This app uses faster-whisper/CTranslate2, not PyTorch.
- Verify GPU detection:
python3 -c "import ctranslate2; print(ctranslate2.get_cuda_device_count())"
- Cloud rental: Use AWS/Google Cloud GPU instances for batch processing
- Alternative: Use
--subs with existing subtitle files (skips transcription, 20x faster)
- Not recommended:
--model tiny is much faster but may miss profanity on complex audio
CUDA / cuDNN errors on Windows
- CUDA/cuDNN are optional. If you see CUDA DLL errors, either:
- Install matching CUDA 12.x + cuDNN 9, or
- Continue on CPU (default path works without GPU libraries)
- Confirm GPU status with
nvidia-smi
- Re-run the tool; it should fall back to CPU automatically when GPU init fails
Detection seems incomplete
- Check transcript:
--dump-transcript words.txt to see what was transcribed
- Verify WPM: Should be >50 for movies (tool warns automatically)
- Audio quality: Dialog enhancement helps but very poor audio may need manual review
- Try larger model:
--model small or --model medium for better accuracy
Out of memory errors
- Close other applications (need 8GB RAM minimum, 16GB recommended)
- Ensure adequate disk space (2x video file size needed temporarily)
- Process shorter videos in batches if system limited
- GitHub Issues: Report bugs and request features
- Discussions: Share tips and ask questions
- Contributions: Pull requests welcome!
- Star this repo: Helps others find the project
Credits
Created and maintained by Adeel Raza.
Original repository:
https://github.com/adeel-raza/profanity-filter
Copyright © 2026 Adeel Raza.
License
This project is licensed under the MIT License. You may use, modify,
integrate, and commercially use this software under the terms of that license.
Contributing
Contributions welcome! Please open an issue or pull request on GitHub.
评论