Cross-platform capture backends (x11grab / avfoundation)

Abierto
#15 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
typescript
Área
desktop

Línea de trabajo

Start with src/utils/targets.ts and trace how buildCaptureArgs, buildScreenshotArgs, and targetInputArgs construct capture arguments; then read src/utils/monitors.ts, src/utils/windows.ts, and src/utils/resolveTarget.ts for target resolution. Begin with the Linux x11grab video scope and use the pure argument builders with an injected platform to test full, monitor, and region targets. Done means those targets build the specified Linux arguments, while unsupported non-Windows window and system-audio requests return clear errors.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

enhancement

Problem

Capture is Windows-only. start_recording and screenshot hardcode -f gdigrab (src/utils/targets.ts: buildCaptureArgs / buildScreenshotArgs / targetInputArgs), and target resolution uses Windows APIs (src/utils/monitors.ts via PowerShell, src/utils/windows.ts for window bounds, wired in src/utils/resolveTarget.ts).

The watch, edit, redact, and produce tools already run anywhere ffmpeg does. Only capture is pinned to Windows.

Proposed backends

Selected by process.platform:

  • win32 -> gdigrab (current).
  • linux -> x11grab: -f x11grab -framerate N -video_size WxH -i $DISPLAY+X,Y. Native offset/region, mirrors gdigrab closely (lowest-risk first target).
  • darwin -> avfoundation: -f avfoundation -framerate N -i "<screen-index>". No native offset, so a region: needs -vf crop=w:h:x:y over a full-screen grab; needs screen-recording permission (TCC); the screen device index comes from ffmpeg -f avfoundation -list_devices true -i "".

Architecture sketch

  • Add a host-platform helper (overridable via env for tests).
  • Refactor targetInputArgs into a backend-aware captureInputArgs(target, platform, monitors) and thread a platform option through buildCaptureArgs / buildScreenshotArgs, so the pure builders stay unit-testable for all three platforms on any host.
  • Per-platform monitor enumeration: keep Windows (getMonitors), add Linux via xrandr and macOS via the avfoundation device list.
  • window: targets and system audio stay Windows-only initially (they need xdotool / BlackHole / pulse), with a clear error on other platforms.

Suggested sequencing

  1. Linux (x11grab) first; scope to video full / monitor / region.
  2. macOS (avfoundation) as a follow-up.

Testing reality

The pure arg-builders are fully unit-testable by injecting platform. Actual x11grab / avfoundation runtime can only be verified on those OSes, not from the Windows dev box.

Scope decisions (from planning)

  • Video full / monitor / region cross-platform; window: + system audio stay Windows-only initially.

Recorded from a planning session; not yet scheduled for implementation.

Lenguaje dominante
TypeScript
Estrellas
1
Forks
4
Merge medio
14 h 8 min
PR fusionados (30 d)
48

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TMHSDigital/screencast-mcp

Todos los issues de TMHSDigital/screencast-mcp

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.