Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only record selected window #47

Open
dehlen opened this issue Mar 25, 2019 · 1 comment
Open

Only record selected window #47

dehlen opened this issue Mar 25, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@dehlen
Copy link
Owner

dehlen commented Mar 25, 2019

This is a feature request I got from a colleague:

Problem description:
When selecting a window with rounded corners (for example the iOS Simulator) the recorded video currently records parts of the desktop background or any other underlying window. This happens because the frames of the recorded video are not "screenshots" of the window but "screenshots" of the screen at the given coordinates. There is nothing we can do about that when the user selects a custom crop frame. However when a window is selected and recorded without modifications to the crop frame we know for sure that only the selected window should be recorded.

Proposed Solution
There is a method called CGWindowListCreateImage which we could use to create snapshots of the selected window. This would lead to frames which have an alpha color around these rounded corners and would address the above stated problem. We would create a timer which creates such an image every 1/fps seconds and adds them to a queue. When the recording is finished this queue of images is then exported to a GIF/movie. However by doing so we introduce multiple implementation problems:

  1. We need to implement stitching these frame to a video file by our own since the user might want to have a resulting video file next to the GIF. This is currently done by AVCaptureSession. I am not sure it would be possible to still use AVCaptureSession. However this might just be me not finding the correct API to do so.
  2. The separate frames are pretty large in size and this leads to a very large GIF file (without making quality compromises). Again this might be addresses by some high level Apple API like AVCaptureSession but currently I only see how to capture input from a CGDirectDisplayID not from a CGWindowID.

So technically this is possible but we need to make sure that this enhancement will be worth the effort.

@dehlen dehlen added the enhancement New feature or request label Mar 25, 2019
@dehlen
Copy link
Owner Author

dehlen commented Mar 25, 2019

Currently I have a working prototype implementing the solution stated above. However before integrating this into Capture the problems would need to be addressed. Any thoughts on this are appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant