Skip to content

fix: properly apply cropArea to SCStreamConfiguration#1

Open
giorgio-zamparelli wants to merge 10 commits intofchevallieratecna:mainfrom
giorgio-zamparelli:main
Open

fix: properly apply cropArea to SCStreamConfiguration#1
giorgio-zamparelli wants to merge 10 commits intofchevallieratecna:mainfrom
giorgio-zamparelli:main

Conversation

@giorgio-zamparelli
Copy link
Copy Markdown

@giorgio-zamparelli giorgio-zamparelli commented Jan 26, 2026

Summary

  • Fixed cropArea parameter not being properly applied to the screen capture
  • Previously, only cropArea.width and cropArea.height were used (for output dimensions), while cropArea.x and cropArea.y were ignored
  • The entire screen was being captured and scaled down to the crop dimensions, instead of capturing only the specified region

Changes

Added proper ScreenCaptureKit configuration in ScreenCaptureKitCli.swift:

  • Set config.sourceRect = cropRect to specify which region of the screen to capture
  • Set config.width and config.height based on the crop area dimensions (scaled by display factor)

Test plan

  • Build the Swift CLI successfully
  • Test with a cropArea that specifies x, y offset (e.g., {x: 200, y: 200, width: 800, height: 600})
  • Verify the recorded video captures only the specified region, not the entire screen

🤖 Generated with Claude Code

giorgio-zamparelli and others added 9 commits January 26, 2026 12:43
Allows specifying a custom output file path instead of using a
temporary file. If not specified, falls back to temp file behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename audioDeviceId (string) to captureSystemAudio (boolean)
- System audio is now disabled by default
- Remove unused device ID validation since it's just a flag
- Update TypeScript types and JSDoc comments
- Update example files

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Increase microphone bitrate from 128kbps to 256kbps
- Change microphone audio from mono to stereo
- Add retry loop (up to 10ms) when AVAssetWriter isn't ready
- Reorder checks to silently discard audio before video starts
- Remove noisy log spam for dropped samples

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add counters for dropped audio samples and video frames
- Print summary at end of recording instead of logging each drop
- Helps diagnose audio quality issues without console spam

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Audio from external devices (e.g., Elgato Wave Link) may have timestamps
earlier than the first video frame, resulting in negative presentation
times. These samples were being placed at time 0 in the output file,
causing audio to play before the corresponding video.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add audioBitRate and audioCodec options to improve audio recording quality:
- audioBitRate: configurable bitrate (default increased to 320kbps from 256kbps)
- audioCodec: support for 'aac' (default), 'alac' (lossless), and 'pcm' (uncompressed)

Apple Lossless (alac) provides highest quality for voice recordings without
compression artifacts.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…king extra requests to find that in the tail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant