Skip to content

CodeOptimist/obs-for-developers

Repository files navigation

OBS ‘Window Capture’ for Developers

Challenge

Unlike streaming video games, showcasing software development entails interaction with many windows, often on multiple monitors.

This inconvenient proliferation of application windows makes anything but 'Display Capture' impractical. This is an unfortunate burden to those who would otherwise be willing to stream from their (often highly-configured) personal or work machines.

To further detriment, arranging windows to fit a solitary display counteracts the productivity boon of extra screen real-estate.

Solution

Leverage the ahkUnwrapped Python package and OBS Scripting API to asynchronously monitor application windows from an allowlist, populating and layering Window Captures within OBS as necessary to reflect focus, child windows, etc.

Demo

See recent Software and Game Development broadcasts at https://www.twitch.tv/CodeOptimist.

Features

  • Explicit allowlist for intentional window captures.
  • Regular expression matching of window titles.
  • On-demand capture of child windows.
  • Capture windows from any monitor.
  • Automated layering by recently focused.

Get started

Automatic configuration

I value minimal setup, but it's not here yet.

Manual configuration

It's recommended that you aren't broadcasting, or if so, edit the included captures.yaml before loading the script.

  1. Install Python 3.6 to a unique path, e.g. %AppData%\..\Local\Programs\Python\Python36-obs
    (Python 3.6 is the latest OBS supports, and it won't use virtualenv.)
    You probably don't want to add this to your system PATH.
  2. Clone (or download) this repository to a preferred location, e.g. C:\path\to\repo
  3. Install dependencies via commandline:
    %AppData%\..\Local\Programs\Python\Python36-obs\python -m pip install -r C:\path\to\repo\requirements.txt
    
  4. Within OBS, create an empty group named Windows on the desired scene(s). The script will manage its contents.
  5. Within OBS, select Tools->Scripts, Python Settings and browse to your Python install path.
  6. Within OBS, select Tools->Scripts, ➕ (Add Scripts) and browse to capture-windows.py
  7. Done. Matching application windows from captures.yaml should automatically be captured within OBS.
  8. Make changes to captures.yaml and 🔃 (Reload) capture-windows.py (make sure it's selected) anytime.

Troubleshooting

POLL_INTERVAL_MS at the top of capture-windows.py will be adjustable from Loaded Scripts in the future. If you encounter:

Encoding overloaded! Consider turning down video settings or using a faster encoding preset.

try increasing the value to 500 (half a second). Default is 250 (and can probably be set to 100 on many machines).