Tvadblocker
TV Ad blocker using OBS Studio and OpenCV (simple logo detection using template matching)
Install / Use
/learn @paratustra/TvadblockerREADME
TV Ad Blocker
Simple TV ad blocker that switches OBS scenes based on logo detection in the top‑right corner. Uses NDI for video input and OpenCV template matching to detect when the channel logo is visible (program) vs faded/absent (ad break).
Requirements
- Python 3.8+
- OBS Studio
- OBS WebSocket (v4) enabled
- obs-ndi plugin + NDI runtime
Install Python deps:
pip install -r requirements.txt
OBS Setup
- Create two scenes:
tv: main programadbreak: what to show during ads (e.g., a calm video)
- Add the NDI source/filter to the
tvscene. - Enable OBS WebSocket on port 4444 with a password.
Configure
Edit config.ini:
[websocket]
host = localhost
port = 4444
password = secret
[opencv]
logo_path = logo.png
threshold = 0.5
interval_seconds = 1.0
roi_width_ratio = 0.25
roi_height_ratio = 0.25
[obs]
tv_scene = tv
ad_scene = adbreak
threshold: higher means stricter logo match.interval_seconds: how often to sample frames.roi_*_ratio: size of top‑right region of interest.
Replace logo.png with the channel logo (cropped and clear works best).
Run
python main.py --config config.ini --log-level INFO
Notes
- The script reads the NDI top‑right ROI to speed up matching.
- Scenes are switched via OBS WebSocket
SetCurrentScene. - Stop with Ctrl+C.
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
