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

mac-capture: add audio-only toggle to macOS Screen Capture

Open jcm93 opened this issue 3 years ago • 0 comments

Description

Adds a toggle to macOS Screen Capture properties for audio-only stream output for the selected window/display/application, rather than both an audio and video stream output.

I have discussed this to a limited degree previously with gxalpha and Pat. This was one suggested possible route to achieve the desired functionality that I decided to go ahead and implement to get the ball rolling. If macOS 13 is available, the checkbox is presented to discard video. If discard_video is true, only the audio stream output is activated rather than both audio and video streams. The capture struct's frame is also set to CGRectZero. This is my first contribution so I hope I have not violated any patterns with this, but I tested it on my machine to make sure it behaves as expected.

I hope that even if this is not implemented it serves to start the discussion for how it can be properly implemented!

Screenshot 2022-12-25 at 11 54 50 PM

Motivation and Context

The overall motivation for this PR is to provide a way for program and desktop audio to be captured by itself on macOS, without associated video. Currently this requires the use of third party programs like BlackHole, or alternately requires the user to add an SCK source and then resize it to zero or place it off the canvas.

There has been some discussion as to the best way to achieve this goal. This PR represents one way to achieve the functionality, with minimal changes to the existing SCK source to accommodate audio-only streams.

How Has This Been Tested?

Tested locally on my machine with macOS 13.2, M1 MacBook Pro.

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [ ] I have included updates to all appropriate documentation.

jcm93 avatar Dec 26 '22 07:12 jcm93