-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
π― Objective
Implement the core screen recording functionality using Windows Desktop Duplication API with cursor tracking, audio capture, and video encoding.
π Tasks
2.1 Windows Desktop Duplication API Integration β‘ HIGH PRIORITY
- Research available libraries:
- Evaluate
windows-capturenpm package - Assess if custom native C++ addon is needed
- Document pros/cons of each approach
- Evaluate
- Choose implementation strategy
- If using native addon:
- Set up node-addon-api project structure
- Create C++ bindings to DXGI Desktop Duplication API
- Implement
IDXGIOutputDuplicationinterface wrapper - Implement frame acquisition from GPU
- Test on different GPU vendors (NVIDIA, AMD, Intel)
- If using library:
- Install and configure chosen library
- Create wrapper module for consistent API
- Implement features:
- Capture frames from specific monitor
- Support multi-monitor selection
- Target 60 FPS minimum capture rate
- Implement frame buffer retrieval
- Add frame timing/synchronization
- Set up IPC for streaming frames to renderer process
- Optimize memory usage (reuse buffers)
- Add error handling for GPU unavailable scenarios
2.2 Cursor Position Tracking
File: electron/recorder/cursorTracking.js
- Create cursor tracking module
- Integrate Windows GetCursorPos API
- Capture cursor position at 120Hz+ frequency
- Store X/Y coordinates with precise timestamps
- Track cursor state changes:
- Detect cursor icon type (arrow, hand, text, etc.)
- Record cursor visibility state
- Implement click detection:
- Capture left mouse button events
- Capture right mouse button events
- Store click events with timestamps
- Add optional keyboard event tracking
- Create synchronized data structure:
- Align cursor data with frame timestamps
- Implement efficient storage format (JSON/binary)
- Add data serialization for saving
2.3 Audio Capture
- Implement system audio capture:
- Research Windows WASAPI vs Web Audio API
- Choose implementation approach
- Capture desktop audio output
- Handle audio device selection
- Implement microphone capture:
- Add microphone input support
- Allow user to toggle mic on/off
- Mix system audio and mic audio
- Audio processing:
- Synchronize audio with video frames
- Handle sample rate conversion if needed
- Add audio level monitoring
- Implement audio buffer management
2.4 Video Encoding Pipeline
File: electron/recorder/videoEncoder.js
- Integrate FFmpeg:
- Download and bundle FFmpeg binaries
- Create FFmpeg process wrapper
- Set up frame streaming to FFmpeg stdin
- Implement encoding options:
- Configure H.264 codec settings
- Support quality presets (720p, 1080p, 1440p, 4K)
- Configure bitrate settings
- Set up frame rate control
- Create encoding modes:
- Real-time encoding mode (encode while recording)
- Raw capture mode (save frames, encode later)
- Allow user to choose mode
- Audio encoding:
- Mux audio streams with video
- Configure AAC audio codec
- Sync audio/video streams
- Add progress monitoring:
- Parse FFmpeg output for progress
- Calculate encoding speed
- Estimate time remaining
2.5 Recording Session Management
- Create recording controller:
- Start recording command
- Stop recording command
- Pause/resume functionality
- Cancel recording with cleanup
- Implement session state:
- Track recording status
- Store session metadata
- Calculate recording duration
- File management:
- Generate unique filenames
- Save to user-specified directory
- Handle disk space checks
- Implement auto-save on crash
π― Success Criteria
- Can capture screen at 60 FPS or higher
- Cursor position is accurately tracked
- Audio is captured and synchronized
- Video is encoded to MP4 successfully
- Can record, pause, and stop without crashes
π§ Technical Notes
- Desktop Duplication API requires Windows 8 or later
- GPU must support DirectX 11.1
- Consider fallback for older systems (GDI+ capture)
π Related
- Original feature request: make screen recorderΒ #1
- Depends on: Phase 1
Estimated Duration: Weeks 2-3
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels