Scripting a fix for Display Capture "Identity" issues on identical hardware?

markiej

New Member
I’m deploying a recording solution across thousands of identical Windows-based medical imaging systems. Each has a dual-monitor setup (primary display + secondary touchscreen) with consistent resolutions and configurations.

The Problem:OBS identifies displays using unique hardware IDs. Even on identical machines, the scene.json file treats each monitor-PC pairing as unique. This requires a manual "re-selection" of the display source for every new unit, which is impossible to scale.

The Goal:Since I cannot find a "generic display" setting in OBS, I want to automate this configuration.

The Question:Has anyone successfully used a script (Python/PowerShell) to poll the current system's monitor IDs and inject them into the OBS scene.json files automatically? I’m looking for examples of writing these specific hardware identifiers to the JSON to bypass the manual configuration step.
 
I found a solution so I though I'd share, in case anyone else is interested in using OBS this way. When my utility launches, it first launches OBS in the background, and quickly closes it. This generates a log file which includes information queried from the local system, which includes the unique monitor_id of physically attached devices. The utility scans the log file for the new id then injects that monitor id from the log file into the appropriate scene json file and voila - it works!


DETAIL
The log files are in OBS\config\obs-studio\logs\
The file is very human readable. you can quickly spot the attached displays under each video adapter. and it will show details about resolution and refresh rate etc. So in my case I had the script look for the instance starting with"output 0:" then look for the next line starting with"id-"
example: id=\\?\DISPLAY#GSM5B08#5&254fefa1&0&UID4354#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}

it then copies the rest of the line. example \\?\DISPLAY#GSM5B08#5&254fefa1&0&UID4354#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}

the scene json file is in OBS\config\obs-studio\basic\scenes
the utility looks for the line "name":"main-monitor" (the name I happened to choose for the source I'm using to capture the main display on the device
then looks for the next line starting with "monitor_id":
It pastes log value and makes one tweak to double the amount of slashes (required for json), so that the result is
"monitor_id": "\\\\?\\DISPLAY#GSM5B08#5&254fefa1&0&UID4354#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}"

(I actually had to do this for a couple of displays so there's logic in there to identify the primary and secondary monitor, but it's working flawlessly so far). I thank this forum for the post where I learned that the log file actually stores its detected monitor ids.
 
Back
Top