Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”‡ AI Audio/Video Censor

Automated Profanity & Content Censorship Tool β€” Powered by Whisper ASR

Python 3.8+ License: MIT

An AI-powered command-line tool that automatically detects and censors profanity, abusive, violent, and confidential content from audio and video files. Built using OpenAI's Whisper for speech-to-text transcription with word-level timestamps for precise, frame-accurate censorship.


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    INPUT (Video/Audio)                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              STAGE 1: Audio Extraction                    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                         β”‚
β”‚  β”‚ pydub/FFmpeg β”‚ β†’ Extract audio β†’ Convert to WAV (16kHz)β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              STAGE 2: Speech Transcription                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                         β”‚
β”‚  β”‚   Whisper    β”‚ β†’ Word-level timestamps                 β”‚
β”‚  β”‚  (ASR Model) β”‚ β†’ [{word, start, end}, ...]            β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚            STAGE 3: Content Classification                β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”             β”‚
β”‚  β”‚ Keyword Matching  β”‚  β”‚ Contextual Analysisβ”‚            β”‚
β”‚  β”‚ (Profanity List)  β”‚  β”‚ (Regex Patterns)   β”‚            β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β”‚
β”‚           β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                         β”‚
β”‚                      β–Ό                                    β”‚
β”‚          Flagged Segments [{word, start, end, category}]  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              STAGE 4: Censorship Engine                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                              β”‚
β”‚  β”‚  BLEEP   β”‚  β”‚   MUTE   β”‚                              β”‚
β”‚  β”‚(1kHz tone)β”‚  β”‚(Silence) β”‚                              β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                              β”‚
β”‚                      β”‚                                    β”‚
β”‚            Merge censored audio with video (FFmpeg)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           OUTPUT (Censored Video/Audio + Report)          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

  • 🎀 Whisper-Powered ASR β€” Accurate transcription with word-level timestamps
  • πŸ” Two-Tier Detection β€” Keyword matching + contextual pattern analysis
  • πŸ”‡ Bleep or Mute β€” Choose between tone overlay or silent censoring
  • πŸ“Š Detection Report β€” JSON report with all flagged content & timestamps
  • 🎬 Video Support β€” Process video files (extracts audio, censors, reassembles)
  • 🎚️ Sensitivity Levels β€” Low / Medium / High detection sensitivity
  • πŸ“ Custom Word Lists β€” Add your own profanity/banned words
  • πŸ–₯️ Rich CLI β€” Beautiful terminal output with progress bars and tables
  • πŸ”Œ Modular Design β€” Each component is independent and extensible

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • FFmpeg (required for video files and non-WAV audio formats)
    • Windows: choco install ffmpeg or download from ffmpeg.org
    • macOS: brew install ffmpeg
    • Linux: sudo apt install ffmpeg

Installation

# Clone the repository
git clone https://github.com/yourusername/ai-audio-video-censor.git
cd ai-audio-video-censor

# Create virtual environment (recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Usage

# Basic usage β€” bleep profanity in an audio file
python -m src.main -i input.wav

# Mute mode with high sensitivity
python -m src.main -i podcast.mp3 --mode mute --sensitivity high

# Process a video file with report generation
python -m src.main -i video.mp4 -o clean_video.mp4 --report

# Use a larger Whisper model for better accuracy
python -m src.main -i audio.wav --model small --mode bleep

# Use a custom word list
python -m src.main -i input.wav --wordlist my_words.txt

πŸ“‹ CLI Options

Option Default Description
-i, --input required Input audio/video file path
-o, --output auto Output file path
--mode bleep Censorship mode: bleep or mute
--model base Whisper model: tiny, base, small, medium, large
--sensitivity medium Detection level: low, medium, high
--wordlist built-in Path to custom word list file
--report off Generate JSON detection report
--bleep-freq 1000 Bleep tone frequency (Hz)

Sensitivity Levels

Level Keyword Match Partial Match Contextual Analysis
Low βœ… ❌ ❌
Medium βœ… βœ… ❌
High βœ… βœ… βœ…

πŸ“ Project Structure

ai-audio-video-censor/
β”œβ”€β”€ README.md                    # This file
β”œβ”€β”€ requirements.txt             # Python dependencies
β”œβ”€β”€ setup.py                     # Package setup
β”œβ”€β”€ LICENSE                      # MIT License
β”œβ”€β”€ .gitignore                   # Git ignored files
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ config.py                # Centralized settings
β”‚   └── profanity_words.txt      # Default word list (categorized)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ __init__.py              # Package init
β”‚   β”œβ”€β”€ main.py                  # CLI entry point
β”‚   β”œβ”€β”€ audio_extractor.py       # Audio extraction from video/audio
β”‚   β”œβ”€β”€ transcriber.py           # Whisper transcription engine
β”‚   β”œβ”€β”€ content_classifier.py    # Content detection & classification
β”‚   β”œβ”€β”€ censor_engine.py         # Bleep/mute audio processing
β”‚   β”œβ”€β”€ pipeline.py              # Pipeline orchestrator
β”‚   └── utils.py                 # Logging & helper utilities
β”œβ”€β”€ output/                      # Default output directory
└── samples/                     # Sample files directory

πŸ”§ Supported Formats

Audio

.wav, .mp3, .flac, .aac, .ogg, .wma, .m4a

Video

.mp4, .mkv, .avi, .mov, .webm, .flv, .wmv


πŸ“Š Sample Output

πŸ”‡ AI Audio/Video Censor
Automated Profanity & Content Censorship Tool
Powered by Whisper ASR | Built for OpenVINO GSoC

  Mode:        bleep
  Model:       base
  Sensitivity: medium
  Word List:   profanity_words.txt

──────────────── Pipeline Starting ────────────────
  Input:  D:\samples\interview.wav
  Output: D:\pipeline\output\interview_censored.wav

βœ“ Whisper model 'base' loaded successfully
βœ“ Transcription complete: 342 words detected, language: en
βœ“ Content classification complete: 7 flagged segments found

──────────────── Pipeline Complete ────────────────

      πŸ“Š Censorship Report
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Metric           β”‚ Value   β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Total Words      β”‚ 342     β”‚
β”‚ Flagged Segments β”‚ 7       β”‚
β”‚ Censor Mode      β”‚ BLEEP   β”‚
β”‚ Processing Time  β”‚ 12.4s   β”‚
β”‚ Language         β”‚ en      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

βœ… Output saved: output/interview_censored.wav

πŸ—ΊοΈ Future Roadmap (OpenVINO Integration)

This project serves as a proof-of-concept for the OpenVINO GSoC Project #39. Future enhancements planned:

  1. OpenVINO Model Optimization β€” Convert Whisper to OpenVINO IR format for accelerated inference on Intel hardware
  2. VLM Visual Understanding β€” Use Vision Language Models (via OpenVINO GenAI) to detect violent visual content in video frames
  3. DL Streamer Integration β€” Build a GStreamer-based real-time processing pipeline using Intel DL Streamer
  4. LLM-Based Classification β€” Replace keyword matching with an OpenVINO-optimized LLM for context-aware content understanding
  5. Microservices Architecture β€” Deploy as containerized microservices for scalable production use
  6. Fine-Tuning Support β€” Fine-tune content detection models on domain-specific data

πŸ› οΈ Tech Stack

Component Technology
ASR Engine OpenAI Whisper
Audio Processing pydub, FFmpeg
Content Detection Keyword matching, Regex patterns
CLI Interface argparse, Rich
Language Python 3.8+

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


πŸ™ Acknowledgments


Built with ❀️

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages