wulkano / Aperture

Record the screen on macOS
MIT License
1.23k stars 111 forks source link

Allow to choose window as source? #16

Open demian85 opened 7 years ago

demian85 commented 7 years ago

I've recently reported a bug in Electron regarding a serious low frame rate using desktopCapturer API: electron/electron#8278 Seems that this project will save my life, but since the app I'm working on needs to be able to choose any open window as a recording source and I did not find anything in the documentation, I wonder if this can be accomplished somehow. Does this feature exist or are you planing to include it?

Thanks.

sindresorhus commented 7 years ago

It's possible. We would need to find the wanted window, focus it, get its position & size and only record that. According to this it might be possible to record the window directly too. Not something we currently need for Kap, where this is used, but a good pull request would be welcomed.

demian85 commented 7 years ago

Great, but unfortunately I'm not very familiar with Swift. Will take a look at the code and see if I can do something. Btw, I have 2 more questions:

Thanks.

matheuss commented 7 years ago

That's a pretty wanted feature ☺️ I still need to spend some time thinking and researching about it, but in addition of what @sindresorhus linked, I remember that I read somewhere that we can even do things like captureTheWholeScreen().minus(someWindow). 😮 ☺️

But yeah, I think this would be very useful – we want to provide something like macOS's Cmd+Shift+4 Space on Kap ☺️

skllcrn commented 7 years ago

To answer your additional questions; macOS assigns the display ID's, we do want to surface them via Aperture at some point though. Regarding capturing in different formats, Aperture simply bridges with AVFoundation. Kap uses ffmpeg to create MP4, GIF and WebM files.

I don't know what you're trying to achieve, but I believe this VS Code recorder uses Aperture to record a single window https://github.com/wk-j/vscode-screen-recorder/blob/f310941d0168001bca8790ab77337aecd7f3c96b/src/recorder.ts

demian85 commented 7 years ago

Still not sure if this library can help me. I'm trying to record desktop and share video stream at the same time. Seems like mp4 streaming is not easy because moov atom headers are included at the end of the file. By any chance, do you know how to fix that using AVFoundation? Would need to go with ffmpeg and webm if that doesn't work. Btw, tried ffmpeg & webm and cpu does not seem to go beyond 100%

skllcrn commented 7 years ago

This library has a limited scope and very specific feature set for the time being, see https://github.com/wulkano/aperture.js#why. Leaving this issue open for when we circle back to recording a specific window. Thank you!

ldenoue commented 1 year ago

the new ScreenCaptureKit framework would let us do this. see https://developer.apple.com/documentation/screencapturekit I use it in my own app Screegle https://www.appblit.com/screegle

Laurent