# [Q]: How to generate video_device_id?



## cwbshaw (Dec 7, 2016)

Hi....

I was wondering if someone could tell me how OBS Studio on MS Windows constructs the values for video_device_id and last_video_device_id in the scene .JSON file?

I'm not an expert programmer, but I have tried trawling through the code, but I can't seem to find how/where OBS Studio gets all of the pieces of information it uses to generate these values.

What I am trying to do is use OBS Studio to stream lectures and presentations from different locations and different PCs in the college where I work. 

Ideally I would like to be able to show up before one of these lectures/presentations, plug in a webcam and a mic and use a script (.bat or powershell) to update a preexisting scene.json file with the video_device_id of whatever camera is connected, and then run OBS Studio in portable mode using that scene. 

I can get much of the data via a query for PNPDeviceID in PowerShell Get-WmiObject, but I'm having trouble figuring out where the rest of the data in video_device_id comes from.

Hope what I'm doing makes sense....

Thanks in advance.

Chris.


----------



## Jim (Dec 9, 2016)

It enumerates them via DirectShow.

See:  https://github.com/jp9000/libdshowcapture/blob/master/source/dshow-enum.cpp#L514


----------



## neobits (Apr 10, 2018)

Jim said:


> It enumerates them via DirectShow.
> 
> See:  https://github.com/jp9000/libdshowcapture/blob/master/source/dshow-enum.cpp#L514



Thank you very much!

I was also digging into it and found that win-dshow called 
	
	
    



```
UpdateVideoConfig(obs_data_t *settings)
```
 at line 776 to have the string value of the aforementioned video_device_id
PATH : obs-studio/plugins/win-dshow/*win-dshow.cpp
*
After reviewing the class, I still don't know how is actually created the video_device_id.

When the JSON scene file is created, does the enum mentioned generates the whole id:


```
"last_video_device_id": "FriendlyName:\\\\?\\usb#00vid_0000&pid_0000&mi_00#000&00000000&0&0000#00{00000000-0000-0000-0000-000000000000}\\global"
```

Or where do we get the documentation for the whole id string concatenation?

Thanks!


----------

