How to capture video from specified window on Mac OS

I tried to capture screen video using this example code How to capture screen activity to movie file using AV Foundation

It works fine, but I'm wondering how I can capture a specific window of some particular application (and not the area of ​​the screen specified by CGRect).

I am asking as Google Hangouts can share the said window even though it is not showing. Google hangouts

So my questions are:

  • How can I modify the above code to achieve this?
  • Can multiple windows be captured at the same time?
+3


source to share


1 answer


I'm not sure if it is possible to render the background window video using AVFoundation

, unless you create your own concrete subclass AVCaptureInput

. But taking a screenshot of the background can be done using the CGWindowListCreateImage () function from the framework Core Graphics

. Apple SonOfGrab may find some sample code helpful.



0


source







All Articles