Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mortem Banner

Mortem Trimmer

State-of-the-Art AI-Powered Silence Remover & Noise Reduction Pipeline

Remove silence, kill background noise, and produce broadcast-ready audio/video — all in one command.

FeaturesInstallationUsageVAD EnginesNoise ReductionExamples


What is Mortem?

Mortem is a production-grade Python CLI tool that automatically detects and removes silent segments from audio and video files using cutting-edge Voice Activity Detection (VAD) models, then optionally applies deep-learning-based noise reduction to produce crystal-clear output.

Whether you're a YouTuber, podcaster, video editor, or content creator — this tool saves you hours of manual editing by intelligently trimming dead air and cleaning up noisy recordings with a single command.


Features

Feature Description
3 VAD Engines Silero VAD (neural), Whisper Semantic VAD, Energy-based VAD
2 Noise Reduction Modes DeepFilterNet3 (SOTA deep learning) & Spectral Gating
Video + Audio Support Process MP4, MKV, AVI, MOV, WAV, MP3, AAC, and more
CUDA Acceleration GPU-accelerated inference for blazing-fast processing
Scientific Visualization Auto-generates speech segment plots (timeline chart)
Speech Manifest Exports timestamped transcript of all detected speech segments
Zero AV-Drift Splicing Frame-accurate trim+concat via FFmpeg filter graphs
Strategy Pattern Architecture Clean, extensible OOP design — plug in your own engines

Requirements

  • Python 3.10+
  • FFmpeg installed and accessible (or provide the path via --ffmpeg)
  • CUDA (optional, for GPU acceleration with DeepFilterNet3 and Whisper)

Installation

1. Clone the Repository

git clone https://github.com/fadhiilahahmadzikri/autosilenttrimmer.git
cd autosilenttrimmer

2. Create a Virtual Environment

python -m venv .venv

Activate the virtual environment:

  • Windows (PowerShell):

    .\.venv\Scripts\Activate.ps1
  • Windows (CMD):

    .\.venv\Scripts\activate.bat
  • Linux / macOS:

    source .venv/bin/activate

3. Install Dependencies

pip install numpy soundfile torch torchaudio noisereduce tqdm matplotlib seaborn

For DeepFilterNet3 noise reduction (recommended):

pip install deepfilternet

For Whisper-based VAD:

pip install faster-whisper

4. Install FFmpeg

  • Windows (Chocolatey):

    choco install ffmpeg
  • Linux (apt):

    sudo apt install ffmpeg
  • macOS (Homebrew):

    brew install ffmpeg

Usage

Basic Syntax

python mortem.py -i <input_file> -o <output_file> [options]

Command-Line Arguments

Argument Type Default Description
-i, --input str (required) Path to the input audio/video file
-o, --output str (required) Path for the output file
-m, --method str deepfilter Noise reduction method: none, spectral, deepfilter
--vad str silero VAD engine: none, energy, whisper, silero
--min-silence float 0.5 Minimum silence duration (seconds) to trigger a cut
--pad float 0.2 Padding (seconds) added around each speech boundary
-f, --ffmpeg str C:\ProgramData\chocolatey\bin\ffmpeg.exe Path to FFmpeg executable

VAD Engines

Silero VAD (Default — Recommended)

Neural network-based acoustic voice activity detection. Fastest and most reliable for general use.

python mortem.py -i input.mp4 -o output.mp4 --vad silero

Whisper Semantic VAD

Uses OpenAI's Whisper model to transcribe audio and extract word-level timestamps. Best for content where semantic accuracy matters (e.g., podcasts with music).

python mortem.py -i input.mp4 -o output.mp4 --vad whisper

Energy-Based VAD

Lightweight, zero-dependency VAD using signal energy thresholding. Great for clean recordings with obvious silence gaps.

python mortem.py -i input.wav -o output.wav --vad energy

Noise Reduction

DeepFilterNet3 (Default — SOTA)

State-of-the-art deep neural network for real-time speech enhancement. Supports CUDA GPU acceleration with chunked processing for O(1) memory usage.

python mortem.py -i input.mp4 -o output.mp4 -m deepfilter

Spectral Gating

Classic signal processing approach using noisereduce library. Lightweight and CPU-friendly.

python mortem.py -i input.wav -o output.wav -m spectral

No Noise Reduction

Skip noise reduction entirely — only perform silence trimming.

python mortem.py -i input.mp4 -o output.mp4 -m none

Examples

Remove silence from a video (default settings)

python mortem.py -i raw_video.mp4 -o clean_video.mp4

Podcast cleanup with aggressive silence removal

python mortem.py -i podcast.wav -o podcast_clean.wav --min-silence 0.3 --pad 0.1

Video with only silence trimming (no noise reduction)

python mortem.py -i lecture.mp4 -o lecture_trimmed.mp4 -m none --vad silero

Full pipeline with Whisper VAD + DeepFilterNet3

python mortem.py -i interview.mkv -o interview_clean.mkv -m deepfilter --vad whisper

Audio-only processing with spectral gating

python mortem.py -i recording.wav -o recording_clean.wav -m spectral --vad energy

Custom FFmpeg path

python mortem.py -i input.mp4 -o output.mp4 -f /usr/bin/ffmpeg

Output Files

After processing, the tool generates:

File Description
output.mp4 The final cleaned & trimmed media file
output.mp4.manifest.txt Timestamped speech segment transcript
output.mp4.plot.png Scientific visualization of speech vs silence timeline

Architecture

The project follows the Strategy Pattern with clean interface abstractions:

INoiseReductionStrategy          IVoiceActivityDetector          IMediaManager
├── DeepFilterNetStrategy        ├── SileroBasedVAD              └── FFmpegMediaManager
├── SpectralGatingStrategy       ├── WhisperBasedVAD
                                 └── EnergyBasedVAD

                    AudioProcessor (Orchestrator)
                    StrategyFactory (Builder)

Troubleshooting

Issue Solution
WinError 127 (DLL conflict) Run pip uninstall torch torchaudio -y then pip install torch torchaudio
FFmpeg not found Install FFmpeg or pass the correct path via --ffmpeg
CUDA out of memory DeepFilterNet3 uses chunked processing — try reducing chunk size or use CPU
Whisper VAD is slow Use silero VAD instead for faster processing

License

This project is open source and available under the MIT License.


Star This Repo

If this tool saved you time, please star this repository — it helps others discover it!


Built by fadhiilahahmadzikri

About

AI-Powered Auto Silence Trimmer & Noise Reduction | DeepFilterNet3 + Silero VAD + Whisper | Remove silence, kill background noise from video/audio in one command | CUDA GPU accelerated | Python CLI

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages