Skip to content
forked from mmguero/cleanvid

cleanvid is a little script to mute profanity in video files

License

Notifications You must be signed in to change notification settings

giveen/cleanvid

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧼 cleanvid

cleanvid mutes profanity in video files by using subtitle-based detection and audio stream editing. It supports fast audio muting, subtitle cleaning, and hardware-accelerated video encoding (GPU) for maximum performance.

Features

  • Mute audio segments containing profanity (based on subtitles and a customizable word list)
  • Create clean subtitle files with censored phrases
  • Optionally embed or hardcode subtitles
  • Generate EDL and PlexAutoSkip JSON files for external players
  • Fast processing: copy video, re-encode audio only, or fully re-encode video
  • NEW: Automatic GPU acceleration (--gpu) for NVIDIA, Intel, or AMD

Installation

Prerequisites

  • Python 3.7 or newer
  • FFmpeg (v6 or newer recommended)
    • Install via your OS package manager (e.g., sudo apt install ffmpeg) or from ffmpeg.org

Recommended: Use a Python virtual environment

python3 -m venv .venv
source .venv/bin/activate

Install from source (for latest development version)

git clone https://github.com/giveen/cleanvid.git
cd cleanvid
pip install -e .

Required Python packages (if installing manually)

pip install babelfish pysrt subliminal

Verify installation

cleanvid --help

Usage

Basic Example

cleanvid -i input.mp4 -s subs.srt -o output.mp4 --re-encode-audio

Fastest (audio-only mute, copy video)

cleanvid -i input.mp4 -o output.mp4 -a "-c:a aac -b:a 224k -ar 48000" -v "-c:v copy"

Full re-encode (CPU)

cleanvid -i input.mp4 -o output.mp4 --re-encode-video -v "-c:v libx264 -preset fast -crf 22 -threads 8" -a "-c:a aac -b:a 224k -ar 48000"

GPU acceleration (NVIDIA/Intel/AMD)

cleanvid -i input.mp4 -o output.mp4 --re-encode-video --gpu

This will auto-detect your GPU and select the best encoder (e.g., h264_nvenc for NVIDIA).

Show all options

cleanvid --help

Running the GUI (development)

Note: The GUI is experimental and is in active development. Use these instructions to run the development GUI locally.

  1. Create and activate the virtual environment (if you haven't already):
python3 -m venv .venv
source .venv/bin/activate
  1. Install the package in editable mode (this will also install GUI/runtime dependencies declared in the project):
pip install -e .
  1. Launch the GUI (from the repository root):
python src/cleanvid/cleanvid_gui.py

If you encounter missing dependency errors, run pip install -e . again or install the missing package directly. The GUI is intended for development and testing; usage instructions and features may change.

Major CLI Options

  • -i, --input Input video file (required)
  • -o, --output Output video file
  • -s, --subs Subtitle file (.srt)
  • -w, --swears Profanity list file
  • -v, --video-params Custom ffmpeg video parameters
  • -a, --audio-params Custom ffmpeg audio parameters
  • --re-encode-video Force video re-encoding
  • --re-encode-audio Force audio re-encoding
  • --gpu Enable GPU acceleration (auto-detects and selects best encoder)
  • --embed-subs Embed subtitles in output
  • --burn Hardcode subtitles (implies re-encode)
  • --subs-only Only operate on subtitles
  • --edl Generate EDL file
  • --json Generate JSON file for muted segments

GPU Acceleration FAQ

  • How do I enable GPU? Add --gpu to your command. cleanvid will auto-detect NVIDIA, Intel, or AMD and select the best encoder.
  • What if I have multiple GPUs? cleanvid uses the first detected GPU. For advanced control, manually set -v "-c:v h264_nvenc" or similar.
  • What if no GPU is found? cleanvid falls back to CPU encoding (libx264).

Docker Usage

Build the image:

./docker/build_docker.sh

Run in Docker:

sudo docker run --rm \
  -v "$PWD:/videos" \
  --entrypoint cleanvid \
  oci.guero.org/cleanvid:latest \
  -i /videos/input.mp4 --re-encode-video -o /videos/output.mp4

Troubleshooting

  • ffmpeg not found: Install ffmpeg and ensure it is in your PATH.
  • Missing Python packages: Run python3 -m pip install -U -r requirements.txt.
  • GPU not detected: Ensure drivers and runtime libraries are installed. Use nvidia-smi (NVIDIA), vainfo (Intel/AMD) to verify.

License

BSD 3-Clause License — see LICENSE


🤝 Contributing

Pull requests are welcome! If you’d like to help improve cleanvid, feel free to fork and submit changes.


👤 Author

** Original Author ** Seth Grovermmguero

** Re-write Author: Giveen**


📄 License

BSD 3-Clause License — see LICENSE


🙏 Acknowledgments

Thanks to:

About

cleanvid is a little script to mute profanity in video files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 97.7%
  • Shell 1.3%
  • Dockerfile 1.0%