Skip to content

win-capture: add capturing specific window by PID#13302

Open
PerikiyoXD wants to merge 1 commit intoobsproject:masterfrom
PerikiyoXD:pxd/capture-window-by-pid
Open

win-capture: add capturing specific window by PID#13302
PerikiyoXD wants to merge 1 commit intoobsproject:masterfrom
PerikiyoXD:pxd/capture-window-by-pid

Conversation

@PerikiyoXD
Copy link
Copy Markdown

@PerikiyoXD PerikiyoXD commented Apr 7, 2026

Description

Adds the ability to select a capture target by process ID (PID), providing reliable window capture when multiple windows share the same title. A new "Capture by PID" checkbox toggles between the existing title-based window selector and a PID-based dropdown that lists all visible top-level windows with their PID, executable, and title.

ms_find_window_by_pid and ms_fill_pid_window_list have been added to window-helpers in libobs so the implementation reuses existing window validation logic (check_window_valid, IsWindowCloaked, internal Microsoft executable filtering) rather than duplicating it.

Locale strings added for en-US and es-ES.

imagen imagen imagen

Motivation and Context

When the same application is launched more than once, all instances share the same window title. The existing title/class/executable matching always resolves to the first instance with no way to target a specific one. Selecting by PID uniquely identifies the intended window regardless of title.

Caveats: PID mode is Windows-only. PIDs are not stable across sessions. If the target process is restarted, its PID changes and the capture source must be reconfigured manually. This mode is intended for cases where title-based matching is ambiguous, not as a general replacement for it.

How Has This Been Tested?

Tested on Windows 10 x64 LTSC, AMD64, NVIDIA GPU.

  • Verified BitBlt and WGC capture methods both work in PID mode
  • Verified switching between title-based and PID-based modes mid-session
  • Verified capture resumes correctly after the target process exits and is relaunched
  • No regressions observed in existing title-based capture behavior
  • Changes touch window-helpers.c/h and window-capture.c plus locale files

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines.
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

- provides better control when multiple windows share the same title
- extends window-helpers with ms_find_window_by_pid and ms_fill_pid_window_list
- en-US and es-ES locale strings provided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant