Automatic video detection and screen dimming for OLED burn-in protection
Cinema Mode is a Python-based utility designed for OLED monitors. It automatically detects video players in web browsers (YouTube, Twitch, Kick, etc.) or desktop media players (VLC, MPV) and dims the rest of the screen to True Black (or custom opacity). This helps prevent burn-in on OLED screens and provides a more immersive viewing experience.
-
π― Automatic Video Detection: Intelligently finds the video player canvas on your screen using Windows Accessibility APIs. Ignores sidebars, comments, and other UI elements.
-
π₯οΈ OLED Protection: Dims static elements (taskbar, browser tabs, chat windows) to pure black to reduce uneven pixel wear.
-
π Smart Whitelist: Only activates on sites you explicitly allow (e.g., "Twitch", "YouTube"). Prevents accidental dimming on miscellaneous elements.
-
π¬ Chat Exemptions: Draw "keep-clear" zones around chat boxes (e.g., Twitch Chat) to keep them visible while the rest of the screen dims. Exemptions are context-aware and only activate on the specific site they were created for.
-
π Volume Control: Includes a custom toggle sound with a volume slider.
-
π System Tray Integration: Minimizes silently to the tray. Double-click the icon to open settings.
-
π₯οΈ Multi-Monitor Support: Works correctly on secondary monitors with different DPI scalings.
You must have Python 3.7+ installed. The script relies on the following libraries:
pip install uiautomation keyboard pystray pillow pywin32Ensure the following files are located in the same folder:
cinema.py- The main application scriptcinema.bat(Optional) - Batch file to launch the script silently
The application will automatically create these files in the same folder to save your settings:
cinema_config.json- Stores opacity, volume, and refresh rate settingscinema_exemptions.json- Stores your saved chat exemption coordinatescinema_whitelist.json- Stores the list of allowed websites
Run the script via command line:
pythonw cinema.pyTip: Using
pythonwhides the black command prompt window.
Or double-click cinema.bat for silent startup.
Pro Tip: Right-click
cinema.batand select Create Shortcut. Drag this shortcut to your Desktop or pin it to your Start Menu to launch it like a regular app.
- Open a video site (e.g., YouTube)
- Click "Add Current Site to Whitelist"
- Enter a keyword to match (e.g.,
YouTube) and a display label (e.g.,YouTube (youtube.com)) - The script will now allow dimming on any window title containing "YouTube"
- Press F9 to toggle Cinema Mode ON/OFF
- Double-click anywhere on the black dimmed area to instantly turn it OFF
- Open a stream with a chat you want to see
- Click "+ Create New Exemption"
- The screen will turn gray - click and drag a box around the chat area
- Give it a name (e.g., "Twitch Theater Chat")
- Enable it in the list - this hole will only appear when you are on that specific site
Adjust the slider to change the dimming level (10% to 100% Black).
Adjust the beep volume for the F9 toggle.
How often the script checks for video position changes (default: 0.5 seconds).
- Closing the window minimizes it to the system tray
- Right-click the tray icon to Quit
| Hotkey | Action |
|---|---|
| F9 | Toggle Cinema Mode ON/OFF |
| Double-click dimmed area | Instantly disable dimming |
Do not click inside the black command prompt window if you are running it manually (this pauses Python). Use pythonw or the tray icon.
Ensure your browser is the active window. The script focuses on the foreground window.
Make sure the browser window is visible and focused before creating exemptions.
- Ensure the site is in your whitelist
- The video must be playing and visible on screen
- Try refreshing the page or restarting Cinema Mode
["Kick", "YouTube", "Twitch"]{
"opacity": 0.9,
"sound_enabled": true,
"refresh_rate": 0.5
}{
"Kick Chat": {
"type": "relative",
"rect": [0.833, 0.273, 0.163, 0.589],
"domain": "NickLee Stream - Watch Live on Kick - Brave"
}
}Cinema Mode uses Windows UIAutomation API to traverse the accessibility tree of browser windows and detect video elements (<video> tags in HTML). Once found, it:
- Gets the exact screen coordinates of the video canvas
- Creates 4 black overlay windows around it (top, bottom, left, right)
- Excludes any chat exemption zones you've defined
- Updates in real-time as the video moves or resizes
This is far more reliable than pixel detection or fixed percentage-based estimation.
Static UI elements like taskbars, browser tabs, and chat windows can cause uneven pixel wear on OLED displays. Cinema Mode protects your screen by:
- Dimming all static elements to pure black (pixels off)
- Only showing the video content at full brightness
- Automatically hiding overlays when you switch windows
- Allowing you to keep specific areas (like chat) visible
- Add to Startup: Place a shortcut to
cinema.batin your Windows Startup folder - Multiple Monitors: Works correctly with different DPI scalings
- Theater Mode: Automatically adapts when you switch between YouTube's default and theater modes
- Fullscreen: Automatically disables when video goes fullscreen
This is a personal utility. Use and modify as needed.
Created using Python with Windows UIAutomation for automatic video detection. Designed specifically for OLED monitor burn-in protection.