How arjncx-lang/screenme works
Purpose and Runtime
Screenme is a local-only Windows 10/11 desktop screen recorder. It captures display video through FFmpeg, records microphone and system audio, and writes MP4 recordings plus optional PNG step screenshots to local user folders. The application is Python 3.10+; FFmpeg is an external executable provisioned in portable releases or by tools/download_ffmpeg.py.
Primary entry point: app/main.py. Portable bootstrap and launch are setup.bat and run_screenme.bat.
Application Composition
The application coordinates four major subsystems:
• Runtime initialization, settings, logging, platform capability detection, and FFmpeg resolution: app/main.py, app/core/settings.py, app/core/ffmpeg_finder.py.
• Capture lifecycle orchestration—start, pause/resume, stop, abort, output-session creation, and FFmpeg process control: app/capture/recorder.py, app/capture/audio_recorder.py.
• UI controls and capture-safe overlay behavior: app/ui/overlay.py, app/ui/win_exclude.py, app/ui/settings_dialog.py.
• Global keyboard interaction and tray-oriented control flow: app/core/hotkeys.py, app/main.py.
Recording Pipeline
app/capture/recorder.py is the central recording boundary. It likely translates selected capture area, frame/encoder settings, and output paths into FFmpeg screen-capture commands using Windows gdigrab, then manages the long-running encoding process and lifecycle transitions.
app/core/ffmpeg_finder.py resolves the required ffmpeg.exe; app/core/cpu_detect.py supports choosing CPU/GPU-appropriate encoding behavior. FFmpeg is the material external dependency responsible for HD video capture and MP4 encoding.
Recordings are organized as timestamped session directories containing recording.mp4, under the user’s Screenme video location. Path conventions and user storage roots are centralized in app/core/paths.py.
Audio Capture and Device Selection
Audio is separated from video capture into dedicated capture modules. app/capture/devices.py enumerates/selects recording devices, including the preference for an external microphone where available. app/capture/audio_recorder.py manages microphone and WASAPI loopback/system-audio acquisition or its integration into the recording session.
This boundary isolates Windows audio-device concerns from UI state and FFmpeg/video process orchestration.
UI, Capture Exclusion, and Region Selection
app/ui/overlay.py implements the transparent floating recorder controls and recording state presentation. app/ui/win_exclude.py applies the Windows capture-exclusion behavior (WDA_EXCLUDEFROMCAPTURE) so the control bar is not included in the recorded display.
app/ui/region_select.py owns user-driven region selection and supplies capture geometry to the recorder. app/ui/settings_dialog.py exposes persistent user choices, while app/ui/styles.py provides presentation styling rather than capture logic.
Screenshots and Session Artifacts
app/capture/screenshot.py creates PNG screenshots independently of the video lifecycle. During a recording, it emits sequential step_N.png artifacts into that active recording’s session folder; while idle, screenshots go to the user Pictures/Screenme location.
This establishes a key routing boundary: the recorder owns active-session context, while screenshot capture consumes that context when present and otherwise uses idle-output paths from app/core/paths.py.
Control Flow and Persistence
app/main.py constructs application services, initializes logging/settings, creates the overlay and settings UI, and binds UI actions and global hotkeys to recorder transitions. app/core/hotkeys.py enables Start/Stop, Pause/Resume, and Abort without requiring overlay focus.
app/core/settings.py persists capture, device, hotkey, and related user preferences across launches. app/core/logging_setup.py establishes diagnostics for startup, device discovery, FFmpeg invocation, and recording failures.
Main entry points: recorder.py Recording orchestrator · main.py Application host · paths.py Output paths · overlay.py Recorder overlay
Components 19
Runtime & control
- Portable launch · Sets up and launches the local desktop application.
setup.bat - Application host · Composes services and binds controls to recorder transitions.
app/main.py - Settings · Persists capture, device, and hotkey choices.
app/core/settings.py - Diagnostics
app/core/logging_setup.py - Global hotkeys
app/core/hotkeys.py - FFmpeg resolver
app/core/ffmpeg_finder.py - CPU/GPU detection
app/core/cpu_detect.py
Capture pipeline
- Recording orchestrator · Owns session creation and video process lifecycle.
app/capture/recorder.py - Audio recorder · Captures microphone and WASAPI loopback audio.
app/capture/audio_recorder.py - Audio devices
app/capture/devices.py - Screenshot capture · Routes screenshots to an active session or idle picture storage.
app/capture/screenshot.py - FFmpeg · Captures gdigrab video and encodes MP4 output.
UI
- Recorder overlay
app/ui/overlay.py - Region selection
app/ui/region_select.py - Capture exclusion · Excludes recorder controls from captured displays.
app/ui/win_exclude.py - Settings dialog
app/ui/settings_dialog.py
Local storage
- Output paths · Defines user storage roots and session path conventions.
app/core/paths.py - Recording session · Contains recording.mp4 and active-session step screenshots.
- Idle screenshots
Connections 23
- Portable launch → Application host: launches
- Application host → Settings: loads
- Application host → Diagnostics: initializes
- Application host → Global hotkeys: binds
- Application host → Recorder overlay: creates
- Application host → Settings dialog: creates
- Global hotkeys → Recording orchestrator: controls lifecycle
- Recorder overlay → Recording orchestrator: controls lifecycle
- Recorder overlay → Capture exclusion: excludes controls
- Region selection → Recording orchestrator: supplies geometry
- Settings dialog → Settings: updates
- Recording orchestrator → Settings: uses capture preferences
- Recording orchestrator → FFmpeg resolver: resolves
- Recording orchestrator → CPU/GPU detection: selects encoder
- Recording orchestrator → Audio recorder: coordinates
- Audio recorder → Audio devices: selects inputs
- Recording orchestrator → FFmpeg: starts capture process
- Recording orchestrator → Output paths: creates output path
- Output paths → Recording session: locates
- FFmpeg → Recording session: writes recording.mp4
- Screenshot capture → Recording session: writes step_N.png when active
- Screenshot capture → Output paths: uses idle route
- Output paths → Idle screenshots: locates