obs-studio-node-example icon indicating copy to clipboard operation
obs-studio-node-example copied to clipboard

How to get window capture ?

Open gaedlld opened this issue 5 years ago • 5 comments

Hello there, I'm trying to get all opened windows list and display them one by one with a selector (in the renderer). But, here's my question, how to choose window capture instead of obsCamera (in the obsRecorder.js) ? Thanks

gaedlld avatar Jun 07 '20 14:06 gaedlld

I believe that

  const videoSource = osn.InputFactory.create('monitor_capture', 'desktop-video');

has to be replaced with

  const videoSource = osn.InputFactory.create('window_capture', 'desktop-video', {
    window: xyz,
  });

and that we have to specify the window to be captured in the third parameter. But I couldn't get it to work. Neither with the NativeWindowHandle nor with ids...

hrueger avatar Jun 07 '20 16:06 hrueger

@GaeTheDev take a look at https://github.com/Envek/obs-studio-node-example/issues/12#issuecomment-636672631

Does it solve your problem?

Envek avatar Jun 08 '20 11:06 Envek

Hey, thank you @hrueger for your answer, but it's not working for me too... I replaced the window value "xyz" by the window name (found in OBS-Studio) but no result... Do you have any other idea ?

gaedlld avatar Jun 09 '20 14:06 gaedlld

Sorry @Envek I didn't see your comment ! I tried it and it's working to get a list of all opened windows but not to get displayable result. I get only mouse capture with black screen and screen size instead of window size (I think I need to crop it with window width & height)

image

gaedlld avatar Jun 10 '20 09:06 gaedlld

Sorry @Envek I didn't see your comment ! I tried it and it's working to get a list of all opened windows but not to get displayable result. I get only mouse capture with black screen and screen size instead of window size (I think I need to crop it with window width & height)

image

i think you should add this input to a scene, then can display it, i work it out QQ截图20200707174604

ChaosTong avatar Jul 07 '20 09:07 ChaosTong