Skip to content

BeyondSmash/Cinema-Mode

Repository files navigation

Cinema Mode for Windows

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.


✨ Features

  • 🎯 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.


πŸ“‹ Prerequisites

You must have Python 3.7+ installed. The script relies on the following libraries:

pip install uiautomation keyboard pystray pillow pywin32

πŸ“ Files & Setup

Required Files

Ensure the following files are located in the same folder:

  • cinema.py - The main application script
  • cinema.bat (Optional) - Batch file to launch the script silently

Generated Files

The application will automatically create these files in the same folder to save your settings:

  • cinema_config.json - Stores opacity, volume, and refresh rate settings
  • cinema_exemptions.json - Stores your saved chat exemption coordinates
  • cinema_whitelist.json - Stores the list of allowed websites

πŸš€ How to Use

1. Start the Application

Run the script via command line:

pythonw cinema.py

Tip: Using pythonw hides the black command prompt window.

Or double-click cinema.bat for silent startup.

Pro Tip: Right-click cinema.bat and select Create Shortcut. Drag this shortcut to your Desktop or pin it to your Start Menu to launch it like a regular app.

2. Whitelist Your Sites

  • 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"

3. Toggle Dimming

  • Press F9 to toggle Cinema Mode ON/OFF
  • Double-click anywhere on the black dimmed area to instantly turn it OFF

4. Create Chat Exemptions (Optional)

  • 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

βš™οΈ Configuration

Opacity

Adjust the slider to change the dimming level (10% to 100% Black).

Volume

Adjust the beep volume for the F9 toggle.

Refresh Rate

How often the script checks for video position changes (default: 0.5 seconds).

System Tray

  • Closing the window minimizes it to the system tray
  • Right-click the tray icon to Quit

⌨️ Hotkeys

Hotkey Action
F9 Toggle Cinema Mode ON/OFF
Double-click dimmed area Instantly disable dimming

πŸ”§ Troubleshooting

Script freezes?

Do not click inside the black command prompt window if you are running it manually (this pauses Python). Use pythonw or the tray icon.

Dimming wrong area?

Ensure your browser is the active window. The script focuses on the foreground window.

"Could not detect window"?

Make sure the browser window is visible and focused before creating exemptions.

Video not detected?

  1. Ensure the site is in your whitelist
  2. The video must be playing and visible on screen
  3. Try refreshing the page or restarting Cinema Mode

πŸ“‚ Example Configuration Files

cinema_whitelist.json

["Kick", "YouTube", "Twitch"]

cinema_config.json

{
  "opacity": 0.9,
  "sound_enabled": true,
  "refresh_rate": 0.5
}

cinema_exemptions.json

{
  "Kick Chat": {
    "type": "relative",
    "rect": [0.833, 0.273, 0.163, 0.589],
    "domain": "NickLee Stream - Watch Live on Kick - Brave"
  }
}

🎯 How It Works

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:

  1. Gets the exact screen coordinates of the video canvas
  2. Creates 4 black overlay windows around it (top, bottom, left, right)
  3. Excludes any chat exemption zones you've defined
  4. Updates in real-time as the video moves or resizes

This is far more reliable than pixel detection or fixed percentage-based estimation.


πŸ›‘οΈ OLED Burn-in Protection

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

πŸ’‘ Tips

  • Add to Startup: Place a shortcut to cinema.bat in 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

πŸ“„ License

This is a personal utility. Use and modify as needed.


πŸ™ Credits

Created using Python with Windows UIAutomation for automatic video detection. Designed specifically for OLED monitor burn-in protection.

About

Cinema Mode for Videos (OLED Burn-In Prevention)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors