π§ AI-powered command-line tool that removes advertisements from podcasts and generates chapters with transcripts.
- π Interactive podcast search using iTunes API
- π€ AI-powered ad detection using Ollama (local, free, unlimited)
- π Full transcription with OpenAI Whisper
- π Auto-chapter generation from topic changes
- βοΈ Surgical ad removal with ffmpeg
- π¦ Multiple output formats:
- Clean MP3 audio (ad-free with embedded chapters)
- VTT transcript with timestamps
- Podcasting 2.0 chapters (JSON)
- Processing report
- π΅ ID3 chapter embedding - Chapters written directly into MP3 metadata (visible in Apple Podcasts, Overcast, Pocket Casts, etc.)
$ podcast-cleaner "glenn beck"
Searching...
1. The Glenn Beck Program (by Mercury Radio Arts)
Select: 1
[1/7] Downloading episode... β
[2/7] Transcribing with Whisper... β (~15 min)
[3/7] AI analyzing for ads... β (~10 min)
β Ad detected at 0m20s: IQOS nicotine
β Ad detected at 1m06s: Relief Factor
[4/7] Generating chapters... β
[5/7] Removing ads... β
[6/7] Creating outputs... β
β Complete!
Original: 42m β Cleaned: 39m (3m of ads removed)
Output files:
β’ The-Glenn-Beck-Program-[date].mp3
β’ The-Glenn-Beck-Program-[date].vtt
β’ The-Glenn-Beck-Program-[date].chapters.json
β’ The-Glenn-Beck-Program-[date].report.txtgit clone https://github.com/adamc199/podcast-ad-cleaner.git
cd podcast-ad-cleaner
chmod +x install.sh
./install.shThe install script will:
- Install system dependencies (ffmpeg, yt-dlp, jq, curl)
- Install Ollama (AI model server)
- Download llama3.2:3b model (~2GB)
- Install Whisper in Python virtual environment
- Set up the podcast-cleaner command
- β Ubuntu / Debian / Pop!_OS / Mint
- β Arch Linux / Manjaro / EndeavourOS
- β Fedora / RHEL / CentOS / Rocky
- β openSUSE / SUSE
If the install script doesn't work for your system:
- Install system dependencies:
# Ubuntu/Debian
sudo apt install python3 python3-pip python3-venv ffmpeg curl jq yt-dlp
# Arch Linux
sudo pacman -S python python-pip ffmpeg curl jq yt-dlp
# Fedora
sudo dnf install python3 python3-pip ffmpeg curl jq- Install Ollama:
curl -fsSL https://ollama.ai/install.sh | sh
ollama serve &
ollama pull llama3.2:3b- Install Whisper:
python3 -m venv ~/.podcast-cleaner-env
source ~/.podcast-cleaner-env/bin/activate
pip install openai-whisper
deactivate- Make script executable:
chmod +x podcast-cleaner.sh./podcast-cleaner.sh "podcast name"# Search and process
./podcast-cleaner.sh "joe rogan"
./podcast-cleaner.sh "lex fridman"
./podcast-cleaner.sh "tim ferriss"
# Interactive mode
./podcast-cleaner.sh
# Then enter podcast name when prompted- Search: Queries iTunes for podcasts matching your search
- Select: Choose from up to 10 results
- Download: Gets the latest episode from RSS feed
- Transcribe: Full episode transcription with Whisper (~15 min for 60-min podcast)
- Analyze: Ollama AI scans transcript for ads and topics (~10 min)
- Remove: Cuts out detected ads with ffmpeg
- Generate: Creates clean audio + chapters + transcript
- Report: Shows statistics and file locations
All files saved to: ~/cleaned-podcasts/
For each processed podcast, you get:
Podcast-Name-Episode-Title.mp3
- Ad-free version
- Original audio quality preserved
- Properly merged segments
Podcast-Name-Episode-Title.vtt
- WebVTT format with timestamps
- Full transcription of cleaned audio
- Compatible with video players
Podcast-Name-Episode-Title.chapters.json
- JSON format chapter markers
- Auto-generated from topic changes
- Can be imported into podcast apps
- Compatible with Podcasting 2.0 spec
Podcast-Name-Episode-Title.report.txt
- Summary of processing
- All ads detected (with timestamps)
- All chapters generated
- Duration statistics
Scans RSS feed for <psc:chapter> tags with [Ad] in the title:
<psc:chapter start="10:18" title="[Ad] Sponsor Name"/>Ollama analyzes the full transcript looking for:
- Sponsor reads ("brought to you by", "sponsored by")
- Product promotions and calls to action
- Promo codes and discount offers
- Financial service ads (credit cards, loans, etc.)
- Phrases like "let's take a break", "after this message"
The AI distinguishes between:
- β Commercial ads: Sponsor reads, product promotions
- β Editorial content: Product mentions in news/discussion
- β Show announcements: Subscribe requests, content previews
If the podcast doesn't include chapters in its RSS feed, the AI automatically generates them by:
- Detecting major topic changes in the transcript
- Identifying natural segment boundaries
- Creating descriptive titles based on content
- Following Podcasting 2.0 chapter specification
For a 60-minute podcast:
- Download: ~5 seconds
- Transcription (Whisper): ~15-20 minutes
- AI Analysis (Ollama): ~10-15 minutes
- Audio processing: ~1 minute
- Total: 30-45 minutes
This is a one-time process. The output is permanent and can be listened to immediately.
- CPU: Multi-core recommended (Whisper and Ollama use CPU)
- RAM: 4GB minimum, 8GB recommended
- Disk: ~3GB for models + space for processed podcasts
- OS: Linux (Ubuntu, Arch, Fedora, etc.)
Current (balanced):
- Whisper:
basemodel - Ollama:
llama3.2:3b(2GB)
Faster (less accurate): Edit script to use:
- Whisper:
tinymodel (~50% faster) - Skip chapter generation
More Accurate (slower):
ollama pull qwen2.5:7b
# Edit script to use qwen2.5:7b instead of llama3.2:3b| Podcast | Ads Detected | Result |
|---|---|---|
| Podnews Weekly Review | 2 ads (1 marked, 1 AI-detected) | β 90s removed |
| Matt Walsh Show | 1 credit card ad (AI-detected) | β 90s removed |
| Glenn Beck Program | Multiple ads (in progress) | β³ Testing |
Default: ~/cleaned-podcasts/
To change, edit podcast-cleaner.sh:
OUTPUT_DIR="$HOME/my-podcasts"Default estimation:
- Pre-roll (first 2 min): 90 seconds
- Mid-roll: 60 seconds
To adjust, edit the script:
AD_DUR=90 # Change to desired durationDefault: base (balanced)
Options:
tiny- Fastest, less accuratebase- Recommended (default)small- More accurate, slowermedium- Very accurate, very slow
Edit script:
$WHISPER original.mp3 --model base # Change 'base' to desired modelDefault: llama3.2:3b (2GB)
Alternatives:
# Download better model
ollama pull qwen2.5:7b # 4.7GB, better quality
# Edit script to use it
ollama run qwen2.5:7b # Replace llama3.2:3b# Check installation
ls ~/.podcast-cleaner-env/bin/whisper
# Reinstall
python3 -m venv ~/.podcast-cleaner-env
source ~/.podcast-cleaner-env/bin/activate
pip install openai-whisper# Start Ollama
ollama serve &
# Check it's running
ollama list
# Test it
ollama run llama3.2:3b "Hello"- Check your search term spelling
- Try more general terms (e.g., "rogan" instead of "joe rogan experience")
- Some podcasts may not be in iTunes directory
This is normal! AI analysis takes time:
- 60-min podcast = 30-45 minutes processing
- Run overnight or during other work
- Consider using
screenortmuxfor long-running jobs
Check the .report.txt file to see what AI detected. The AI is conservative and may miss some ads. You can:
- Manually edit the chapter JSON to mark additional ads
- Use a larger Ollama model for better detection
- Adjust the ad duration estimates in the script
- Transcribe full episode with Whisper
- Split transcript into ~5-minute chunks
- Analyze each chunk with Ollama:
- Identify commercial language
- Find sponsor mentions
- Detect calls to action
- Cross-reference with RSS chapter markers
- Deduplicate and sort detected ads
- Estimate durations based on position
- Extract clean segments with ffmpeg
- Concatenate into final output
VTT Transcript:
WEBVTT
00:00:00.000 --> 00:00:03.600
The last word in podcasting news.
00:00:03.840 --> 00:00:09.200
This is the Pod News Weekly Review...
Podcasting 2.0 Chapters:
{
"version": "1.2.0",
"chapters": [
{"startTime": 0, "title": "Introduction"},
{"startTime": 300, "title": "Main Topic"}
]
}- β 100% Free: No API costs, completely local processing
- β Private: All transcripts stay on your machine
- β Unlimited: No rate limits or quotas
- β Open Source: MIT License
- Only processes the latest episode from a feed
- Transcription takes real time (unavoidable with Whisper)
- AI accuracy depends on clear sponsor language
- Requires decent CPU for reasonable performance
- Linux only (macOS support possible, Windows via WSL)
- Batch processing (multiple episodes)
- macOS support
- GUI option (web interface)
- Voice change detection (host vs announcer)
- Audio fingerprinting for known ads
- User-contributed ad database
- Episode selection (not just latest)
- Cloud AI option (for faster processing)
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test with multiple podcasts
- Submit a pull request
MIT License - See LICENSE file
Created by adamc199
- OpenAI Whisper for speech-to-text
- Ollama for local AI inference
- Meta's Llama 3.2 model
- iTunes Search API
- FFmpeg project
- yt-dlp for audio downloading
For issues, questions, or feature requests:
- Open an issue on GitHub
- Include your Linux distribution
- Attach the processing report file if relevant
Q: How accurate is the ad detection?
A: Very good for clearly marked ads and obvious sponsor reads. May miss subtle product placements or conversational ads.
Q: Can I process old episodes?
A: Currently only processes the latest episode. Batch processing coming soon.
Q: Does this work with all podcasts?
A: Works with any podcast that has an RSS feed accessible via iTunes. Some private/premium podcasts may not be searchable.
Q: Is it legal to remove ads?
A: You're downloading and modifying audio for personal use. Check your local laws. This tool is for personal use only.
Q: Can I speed it up?
A: Use --model tiny for Whisper (50% faster, less accurate) or get a faster CPU. Transcription is the bottleneck.
Q: Why not use cloud AI?
A: Local processing is free, unlimited, and private. Cloud APIs have costs and rate limits. However, you can modify the script to use cloud APIs if desired.
Q: Can this run on Raspberry Pi?
A: Technically yes, but it would be very slow (hours per episode). Recommended: x86_64 CPU with 4+ cores.
Original: 84 minutes
Cleaned: 82 minutes
Removed: 2 minutes (Buzzsprout sponsor + marked ad)
Chapters: 15 generated from topics
Original: 62 minutes
Cleaned: 61 minutes
Removed: 1 minute (credit card ad)
Chapters: 8 generated
Original: 42 minutes
Processing: In progress...
Expected: Multiple sponsor reads (IQOS, Relief Factor, etc.)
β Star this repo if you find it useful!
π Found a bug? Open an issue!
π Want a feature? Submit a PR!