Jump to content

MindAttic.Media.Capture/SPEC

From MindAttic Docs

MindAttic.Media.Capture — Product specification

The complete product, written down before it is built (owner, 2026-11-30, MAT-T360). Every epic, feature and story the finished product will have is listed here, built or not. The ticket tree mirrors this file one to one: every ID below is a ticket. Nothing gets built unless it is here, and anything taken out of here is closed wont-do in the tree. docs/RELEASE.md says which part of this the current milestone delivers.

1. Product definition

In docs/ECOSYSTEM.md this is a platform repo: it owns screen, game and audio capture for every app and game, configured in one place.

MindAttic.Media.Capture is programmatic and hand-driven video capture and screenshots for MindAttic apps and games: trailer footage, store shots, devlog clips, bug-repro video and agents' preview sets. It is for the owner and for the agents and apps that need evidence. Every recording is a time range cut from one rolling tape, so a replay can include the seconds before the event. Hosts wire it in one line (WPF, WebView2, Windows, Unity, Unreal) or record with no code at all (capture.exe, the tray recorder). The finished product records any MindAttic app or game by hand or on its start, with each app's capture profile kept in the tray app, never loses footage, never stalls its host, stays out of shipped builds, and runs from R:\MindAttic\Apps\MindAttic.Media.Capture.

2. Scope boundary

2.1 In the product

  • The capture engine: tape, exports, trigger rules, sidecars, manifest, shut-off valve, crash recovery.
  • Host adapters: WPF, WebView2, in-process Windows, the Unity package, the Unreal plugin through capture host.
  • The agent capture.exe: run/shot/record/replay, serve, web, gif, recover, mcp, migrate-roots, set.
  • Preview sets and the hand-off to MindAttic.Media.Viewer.
  • The tray recorder capture-tray.exe, which also holds every app's capture profile.
  • App-only (per-process) audio.

2.2 Never in the product

  • A windowed recorder app replacing the tray (M.CAPT-T34, 2026-10-19): superseded by the owner's 2026-11-28 direction, which builds record-on-start and per-app profiles on the tray icon (M.CAPT-T245, M.CAPT-T248).
  • Logging through MindAttic.Log (M.CAPT-T16): the core stays dependency-free (M.CAPT-LAW-4) and already writes a per-session log and stats file.
  • Open-ended bughunt or soak loops (M.CAPT-T165).
  • Video editing: Capture cuts ranges and encodes presets; editing happens elsewhere (the Viewer trims and crops).
  • Streaming or broadcasting.
  • Bundling ffmpeg: it uses an ffmpeg.exe on PATH or beside the app.
  • Capture in shipped builds of the apps that use it.
  • Capture configuration shipped inside app repos: profiles live in Capture (owner, 2026-11-28).
  • Engines with no MindAttic consumer (Godot and others): an engine binding is added only when a game on it exists.

3. Users and roles

  • The owner records by hand (screens, apps, areas, focused windows), arms apps to record on start, and reviews footage.
  • App and game developers (MindAttic repos) wire one line and raise events; their games read their profile from Capture.
  • Agents build preview sets as evidence for tickets, record pages headlessly and call capture mcp.
  • MindAttic.Media.Viewer opens the sets Capture writes; the Orchestrator shows them.

4. Requirements

Status is built (closed ticket, with evidence) or MS-n: the milestone in §7 that delivers it. Every unbuilt story is approved and prioritised in build order; the planner splits a story into tasks when the queue reaches it.

E1. Capture engine core — M.CAPT-T257 — built

The tape, exports, trigger rules, safety valves and output layout every host shares.

F1.1 Tape and exports — M.CAPT-T258 — built

  • S1.1.1 Rolling tape — M.CAPT-T259 — built As a developer, I want every recording cut from one rolling lossless (FFV1) or hardware HEVC tape of 1 s segments, so that starting is instant and a replay includes the seconds before the event. Acceptance: Given a running tape, when SaveReplay(15s, 5s) is called, then the file holds the 15 s before the call. Evidence: README "How it works"; e25fd8f.
  • S1.1.2 Export presets — M.CAPT-T260 — built As a creator, I want a .mkv master plus MP4, WebM, GIF, animated WebP and a thumbnail by preset (Trailer, Lossless, Devlog, BugReport, Session), so that footage drops straight into any editor or store page. Acceptance: Given the Devlog preset, when a clip is exported, then an MP4 at most 1080p is written. Evidence: README "capture.json"; 6f31ee2 (M.CAPT-T209).
  • S1.1.3 Capture from code — M.CAPT-T261 — built As a developer, I want Screenshot, Clip, SaveReplay, Raise and Marker calls, compiled out without MINDATTIC_CAPTURE, so that footage is a by-product of play. Acceptance: Given Capture.Raise("boss-death") and a matching rule, when it fires, then the rule's capture is written. Evidence: src/MindAttic.Media.Capture; README "Quick start".
  • S1.1.4 Trigger rules — M.CAPT-T262 — built As a developer, I want capture.json rules (where, cooldown, debounce, maxPerSession, preset), hotkeys and postCapture commands, so that events turn into the right capture without code. Acceptance: Given a rule with cooldown: 10s, when the event fires twice in 5 s, then one capture is made. Evidence: README "capture.json".
  • S1.1.5 Sidecars and manifest — M.CAPT-T263 — built As a creator, I want a JSON sidecar per file and a session manifest with markers written as video chapters, so that every file says what it shows. Acceptance: Given a session with markers, when it ends, then {stem}.session.json lists every file and the video has chapters. Evidence: README "Output"; OutputManager.

F1.2 Safety — M.CAPT-T264 — built

  • S1.2.1 Off unless asked — M.CAPT-T265 — built As the owner, I want capture to run only when -capture is literally on the command line (or a config is passed explicitly), so that a plain launch is always a plain launch. Acceptance: Given no -capture flag, when the app starts, then no tape and no ffmpeg start. Evidence: README "The -capture flag"; M.CAPT-LAW-1.
  • S1.2.2 Shut-off valve — M.CAPT-T266 — built As the owner leaving a run unattended, I want capture to stop and export before disk, RAM or the encoder runs out, with a stats.csv and log per session, so that a long run cannot hurt the machine. Acceptance: Given minFreeDiskGB: 50, when free disk drops below it, then capture stops, exports, and the manifest records stoppedBy. Evidence: README "The shut-off valve".
  • S1.2.3 Crash recovery — M.CAPT-T267 — built As a developer, I want finished segments kept on disk when an app crashes and exported on the next launch or by capture recover, so that no recorded footage is lost. Acceptance: Given a crashed session, when capture recover runs, then a session-recovered export is written. Evidence: README; M.CAPT-LAW-2.
  • S1.2.4 Detached export — M.CAPT-T268 — built As a developer, I want the session export handed to the installed agent, so that the host app exits immediately. Acceptance: Given the agent installed, when the app closes, then it exits at once and the export finishes after. Evidence: SessionFinalizer; M.CAPT-LAW-3.

F1.3 Output layout — M.CAPT-T269 — built

  • S1.3.1 Session folders by repo — M.CAPT-T270 — built As a creator, I want each app run in its own timestamped folder under R:\MindAttic\Media\Capture\{RepoName} (falling back to the Videos folder), so that captures are filed by project. Acceptance: Given an app run from a repo, when it records, then files land in that repo's folder with the session timestamp prefix. Evidence: 2fc78ee (M.CAPT-T202), bd51753 (M.CAPT-T195).
  • S1.3.2 Migrate legacy roots — M.CAPT-T271 — built As the owner, I want capture migrate-roots to move the old Capture and Preview roots into the Media roots without deleting or overwriting, so that old footage follows the move. Acceptance: Given files in R:\MindAttic\Capture, when --apply runs, then they move and a README is left behind. Evidence: 7b320a3 (M.CAPT-T204), c7318ff (M.CAPT-T203).

E2. Host adapters — M.CAPT-T272 — built

One-line wiring for WPF, WebView2, Windows apps, Unity and Unreal.

F2.1 .NET adapters — M.CAPT-T273 — built

  • S2.1.1 WPF in one line — M.CAPT-T274 — built As a WPF developer, I want CaptureWpf.Init(this, e.Args) to record the main window at native size and export on exit, so that wiring an app takes one line. Acceptance: Given -capture video, when the app exits, then its session .mkv and .mp4 exist. Evidence: src/MindAttic.Media.Capture.Wpf; Automata.
  • S2.1.2 WebView2 bridge — M.CAPT-T275 — built As a web developer, I want window.mindattic.capture (raise, screenshot, replay) in any WebView2 or the MindAttic Browser, so that pages trigger captures. Acceptance: Given the bridge, when a page awaits screenshot('victory'), then a PNG and sidecar are written. Evidence: src/MindAttic.Media.Capture.WebView2; 9457c13 (MAT-T301).
  • S2.1.3 Windows desktop sources — M.CAPT-T276 — built As a developer, I want DesktopCapture with Windows Graphics Capture for windows, Desktop Duplication or GDI for monitors and regions and WASAPI audio, so that any Windows app can be recorded in-process. Acceptance: Given CaptureTarget.CurrentApp, when capture starts, then the app's window is taped. Evidence: src/MindAttic.Media.Capture.Windows.
  • S2.1.4 Out of shipped builds — M.CAPT-T277 — built As the owner, I want capture referenced only outside Release and compiled out by MINDATTIC_CAPTURE, so that shipped builds contain no capture code. Acceptance: Given a Release build, when it is inspected, then it holds no capture assembly. Evidence: README "Production builds".

F2.2 Unity package — M.CAPT-T278 — built

  • S2.2.1 Unity game capture — M.CAPT-T279 — built As a Unity developer, I want game-view GPU readback, game audio, a Play Mode menu and -capture honoured in capture-enabled players, so that games record with no extra code. Acceptance: Given a capture-enabled player started with -capture video, when it quits, then the session exports. Evidence: README "MindAttic.Media.Capture.Unity"; M.CAPT-T167, 2683fbc (M.CAPT-T197).

F2.3 Unreal plugin — M.CAPT-T280 — built

  • S2.3.1 Capture host — M.CAPT-T281 — built As an engine plugin, I want capture host to drive a capture engine on a game window over JSON lines (record, clip, replay, screenshot into a set), so that out-of-process engines can record. Acceptance: Given a JSON record-start line, when the host reads it, then recording starts on that window. Evidence: 780dcaa (M.CAPT-T189), 0d9039f (M.CAPT-T191), da0abc9 (M.CAPT-T222).
  • S2.3.2 Shared-memory frame ring — M.CAPT-T282 — built As an Unreal game, I want to feed backbuffer frames into the SGFR ring that capture host --frames records, so that the game view is captured exactly. Acceptance: Given the plugin feeding the ring, when the host records, then the tape holds the game's frames. Evidence: 27986a9 (M.CAPT-T190), 6ba488a (M.CAPT-T193).
  • S2.3.3 Blueprint API and editor menu — M.CAPT-T283 — built As an Unreal developer, I want C++ and Blueprint calls for recordings, clips, replays and screenshots plus a Tools menu and Play-In-Editor capture, so that capture works from the editor. Acceptance: Given the editor menu, when Play-In-Editor capture is on, then the PIE session is recorded. Evidence: fb134e7 (M.CAPT-T194), 118aba8 (M.CAPT-T195), 21c038f (M.CAPT-T196).
  • S2.3.4 Fixed-step capture — M.CAPT-T284 — built As a developer recording a deterministic run, I want -capture-fixed to take every frame once, in order, into a fixed-timestep tape, so that a recording has no dropped frames. Acceptance: Given -capture-fixed, when the game renders N frames, then the tape holds N frames. Evidence: f7f56f9 (M.CAPT-T242). Its header-validation regression is M.CAPT-T244 (MS-45).

E3. Agent CLI — M.CAPT-T285 — built

capture.exe: record any app, serve pages, web capture, MCP.

F3.1 Record any app — M.CAPT-T286 — built

  • S3.1.1 Run, shot, record, replay — M.CAPT-T287 — built As the owner, I want capture run, shot, record and replay against a monitor, region, window, hwnd or process, so that any app is recorded with no code change. Acceptance: Given capture run -- Game.exe, when the game exits, then its window was recorded from launch. Evidence: README "Any app, no code changes".
  • S3.1.2 Timelapse GIF — M.CAPT-T288 — built As a creator, I want capture gif (and -capture ... gif) to stitch interval screenshots into a stamped timelapse GIF, so that long runs become a short clip. Acceptance: Given a folder of PNGs, when capture gif runs, then {folder}.gif is written at the chosen fps. Evidence: 6f31ee2 (M.CAPT-T209); README.

F3.2 Services — M.CAPT-T289 — built

  • S3.2.1 Localhost API — M.CAPT-T290 — built As a page or script, I want capture serve on 127.0.0.1:47800 (HTTP and WebSocket, token or allowed origin, never running commands), so that browsers and tools trigger captures safely. Acceptance: Given a request without the token from a foreign origin, when it arrives, then it is refused. Evidence: README "Localhost API".
  • S3.2.2 Headless web capture — M.CAPT-T291 — built As an agent, I want capture web to screenshot and record pages headlessly through Playwright and Edge with sidecars, so that sites are captured without a window. Acceptance: Given a URL, when capture web runs, then a screenshot and sidecar are written; a failure leaves no .video folder. Evidence: src/MindAttic.Media.Capture.Web; ce0fcd5 (M.CAPT-T223).
  • S3.2.3 MCP tools — M.CAPT-T292 — built As an LLM agent, I want capture mcp to expose capture operations as MCP tools, so that agents capture evidence directly. Acceptance: Given an MCP client, when it lists tools, then the capture operations appear. Evidence: BIBLE §4.1 (Agent: mcp).

E4. Preview sets — M.CAPT-T293 — built

F4.1 Preview set store — M.CAPT-T294 — built

  • S4.1.1 Build a set — M.CAPT-T295 — built As an agent, I want capture set new and add, and --set on shot and record, so that a ticket's screenshots and clips land as one numbered set with captions. Acceptance: Given a set, when capture shot --set runs, then the shot is the set's next number with its caption. Evidence: README "Preview sets"; 3a4e0aa (M.CAPT-T198); Sets 2.1.0 (e25fd8f).
  • S4.1.2 Show a set — M.CAPT-T296 — built As the owner, I want capture set show to hand a set to the running Media.Viewer (or start it), so that I see what an agent made. Acceptance: Given a running Viewer, when capture set show runs, then the Viewer opens the set. Evidence: e3707ed (MAT-T299).

E5. Hand recorder — M.CAPT-T297 — built

capture-tray.exe: record by hand with no code changes.

F5.1 Recording by hand — M.CAPT-T298 — built

  • S5.1.1 Screen, app and area — M.CAPT-T299 — built As the owner, I want to record or screenshot a monitor, any open app or a dragged area (ratio buttons, saved regions, a red frame while recording), so that I capture exactly what I need. Acceptance: Given Record Area, when I drag and confirm, then that rectangle is recorded until I stop. Evidence: README "Tray recorder"; 3c73ba8 (M.CAPT-T224).
  • S5.1.2 Hotkeys — M.CAPT-T300 — built As the owner, I want rebindable hotkeys for record, screenshot and record-the-focused-window lossless with an MP4 rendered after, so that I capture without touching the menu. Acceptance: Given Ctrl+Alt+Shift+F, when pressed twice, then the focused window's .mkv and .mp4 are written. Evidence: aaf1a3c (M.CAPT-T214), a1d93fa (M.CAPT-T216), be09a86 (M.CAPT-T217).
  • S5.1.3 Record on start — M.CAPT-T301 — built As the owner, I want to arm an app (Next Start or Every Start) from the tray and have it recorded lossless from its first window, with an MP4 on stop, so that games are recorded without passing -capture. Acceptance: Given an app armed for Next Start, when it starts, then it is recorded and the arm clears. Evidence: 461b6c1 (M.CAPT-T245).

F5.2 Settings and install — M.CAPT-T302 — built

  • S5.2.1 Settings in Vault — M.CAPT-T303 — built As the owner, I want the recorder's folder, formats, hotkeys and apps edited in MindAttic Vault and applied without a restart, so that settings live in one place. Acceptance: Given a hotkey changed in Vault, when saved, then the tray uses it at once. Evidence: 17f50fb (M.CAPT-T221); --write-settings-manifest.
  • S5.2.2 Finished-capture notice — M.CAPT-T304 — built As the owner, I want a notification listing finished captures with Open Last Capture and Show in Folder, so that I find the file at once. Acceptance: Given a finished recording, when it saves, then a notice lists it with its size. Evidence: README "Tray recorder".
  • S5.2.3 Installed agent and recorder — M.CAPT-T305 — built As the owner, I want run.ps1 to build the agent and recorder and install the Release build to %LOCALAPPDATA%\MindAttic\Capture\bin with a desktop shortcut, so that apps find the agent. Acceptance: Given run.ps1 -Redeploy, when it finishes, then capture.exe is in the install folder. Evidence: 9389b38 (MAT-T300).

E6. Recording correctness — M.CAPT-T230 — MS-45

Fix the known bugs that drop, overwrite or misplace footage and manifests.

F6.1 Session and manifest — M.CAPT-T233 — MS-45

  • Session end time read after the tape stops — M.CAPT-T47
  • A mid-session finalizer never overwrites the manifest — M.CAPT-T48
  • No manifest with the kill switch off — M.CAPT-T50 Acceptance: Given a session, when it ends, then its end time covers the last segment and one correct manifest exists.

F6.2 Tape and export — M.CAPT-T234 — MS-45

  • ffmpeg with redirected stdin — M.CAPT-T49
  • A replaced non-session tape is deleted once unused — M.CAPT-T59
  • An event's clip reads the tape it was raised on — M.CAPT-T67 Acceptance: Given a console keystroke during an export, when it is pressed, then the export completes.

F6.3 Agent and sources — M.CAPT-T235 — MS-45

  • capture save leaves a running serve session alone — M.CAPT-T51
  • WGC stop no longer races a frame callback — M.CAPT-T52
  • Same-second tray screenshots never collide — M.CAPT-T64
  • The frame ring rejects a bad header or a missing feed again — M.CAPT-T244 (a regression from f7f56f9; proposed, awaiting the owner's approval as an automation-filed fix) Acceptance: Given two screenshots in one second, when both are taken, then both files exist.

E7. Per-app capture profiles — M.CAPT-T252 — MS-45

Every app's capture profile lives in the tray app; engine plugins record only when the tray runs and the app is ticked (owner, 2026-11-28).

F7.1 Profiles in the tray — M.CAPT-T253 — MS-45

  • S7.1.1 One place for every capture profile — M.CAPT-T248 — MS-45 As the owner, I want each app's profile (replay ring, record-on-start, battle and rule clips) kept in the tray app's settings and edited in Vault.Desktop, and the Unity and Unreal plugins to activate only when the tray runs and that app is ticked, so that no capture config lives in app source. Acceptance:
    • Given GridGame unticked in the tray, when it starts with the plugin, then nothing records (GG-T2167 depends on it).
    • Given GridGame ticked with a replay ring, when a battle event fires, then a replay is saved per its profile. Tasks: M.CAPT-T254 tray app profiles, M.CAPT-T255 Unity plugin reads its profile, M.CAPT-T256 Unreal plugin reads its profile (in that order).
  • The apps setting has its own settings test — M.CAPT-T247 (proposed, awaiting approval as an automation-filed fix)

E8. Runs from the standard install — M.CAPT-T232 — MS-45

F8.1 Installed and redeployed from R: — M.CAPT-T238 — MS-45

  • Debug and Release both under R:\MindAttic\Apps\MindAttic.Media.Capture — M.CAPT-T228
  • Redeploy waits for (or skips) a running recording instead of killing it — M.CAPT-T53 Acceptance: Given a recording in progress, when run.ps1 -Redeploy runs, then the recording is not lost.

F8.2 No old installs or stray paths — M.CAPT-T239 — MS-45

  • Committed gitlinks (M.CAPT-T12, main-tests) and test output removed and ignored — M.CAPT-T71
  • C:\Apps\MindAttic.Media.Capture deleted — M.CAPT-T229

E9. App-only audio — M.CAPT-T306 — MS-98

F9.1 Per-process audio — M.CAPT-T307 — MS-98

  • S9.1.1 App audio is the app's own — M.CAPT-T308 — MS-98 As a creator, I want App audio to capture only the recorded app's sound (WASAPI process loopback), so that other apps and system noise stay out of footage. Acceptance: Given music playing in another app, when a game is recorded with App audio, then only the game is heard.

E10. Only current roots and names — M.CAPT-T309 — MS-98

F10.1 Legacy roots and names — M.CAPT-T310 — MS-98

  • S10.1.1 Stop reading old roots — M.CAPT-T311 — MS-98 As the owner, I want capture recover, set listings and the Unity Open Capture Folder to stop reading R:\MindAttic\Capture and R:\MindAttic\Preview, so that only the Media roots exist. Acceptance: Given files left in an old root, when sets are listed, then they are not shown.
  • S10.1.2 Drop the old agent name — M.CAPT-T312 — MS-98 (after M.CAPT-T311) As a maintainer, I want the MindAttic.Capture.Agent product name no longer accepted, so that only MindAttic.Media.Capture.Agent remains. Acceptance: Given a caller naming the old agent, when it looks the agent up, then it is not found.

E11. Release 1.2 — M.CAPT-T313 — MS-98

F11.1 Polish and release — M.CAPT-T314 — MS-98

  • S11.1.1 Ship Media.Capture 1.2 — M.CAPT-T315 — MS-98 (after M.CAPT-T308, M.CAPT-T312) As the owner, I want Media.Capture 1.2 packed to C:\LocalNuGet, the Unity plugin DLL refreshed, the agent and recorder redeployed to R: Debug and Release, and docs/overview.md and this spec current, so that every consumer runs the finished capture tool. Acceptance: Given the release, when a consumer restores packages, then it gets 1.2.0 and the docs describe it.

5. Non-functional requirements

  • Platform: Windows 10/11; core is netstandard2.1 and net10.0 so Unity can consume it; desktop projects target net10.0-windows10.0.19041.
  • Dependencies: the core has no third-party dependencies (M.CAPT-LAW-4); ffmpeg is external, never bundled.
  • Storage: lossless FFV1 is roughly 1-7 GB per minute; output defaults to R:\MindAttic\Media\Capture; nothing is ever deleted automatically.
  • Safety: the shut-off valve (disk, RAM, encoder memory and lag, duration) is on by default.
  • Security: the localhost API binds to 127.0.0.1, needs a token or an allowed origin, and can never run commands.
  • Performance: the host app never stalls (M.CAPT-LAW-3); exports run detached.
  • Compatibility: runtime ids keep the pre-rename names (M.CAPT-LAW-5).

6. Interfaces and dependencies

Platform it relies on (docs/ECOSYSTEM.md): MindAttic.Vault (per-app capture profiles, edited in Vault.Desktop), the shared run menu (run.ps1, MindAttic.Agency deploy-lib) for installs under R:, MindAttic.Agency, MindAttic.Tickets. Consumers: the Unity and Unreal games through its engine plugins.

  • Uses: ffmpeg on PATH; Playwright and Microsoft Edge (capture web); the deployed MindAttic.Browser (capture run --url); MindAttic Vault (tray settings).
  • Used by: MindAttic.Media.Viewer (opens preview sets, mindattic.preview/1); Unity games through com.mindattic.media.capture; Unreal games (SpaceGod.Unreal and others) through the plugin and capture host; WPF apps (Automata); agents through capture set, capture web and capture mcp; the Orchestrator.
  • Cross-repo work: M.CAPT-T250 renames this repo's GridGame references under GridGame.Unity's convergence epic (GG-T2261); GG-T2167 requires M.CAPT-T248.

7. Release sequence

  1. MS-45 — Media.Capture stable recorder (active; docs/RELEASE.md): E6 Recording correctness, E7 Per-app capture profiles, E8 Deploy and repo hygiene.
  2. MS-98 — Media.Capture 1.2: app audio and Media roots only (planned): E9 App-only audio, E10 Retire one-release compatibility, E11 Release 1.2. When it is reached, the product is finished.

8. Change log

Date Change to scope Ticket
2026-11-30 Specification written from README, BIBLE, docs, code and the ticket history. The windowed recorder (M.CAPT-T34 tree) moved to Never as superseded by the tray direction (M.CAPT-T245, M.CAPT-T248); per-app profiles became MS-45's E7; MS-98 finishes the product. MAT-T370
2026-11-30 MAT-T462 single-source pass: 7 renamed, 1 bucket reworded as an outcome (M.CAPT-T232: install and leftovers are one outcome, running from the standard install), 8 requires added, 1 platform re-point (deploy named as the shared run menu); E-release epic M.CAPT-T313 kept as the milestone's closing release MAT-T466
From MindAttic.Media.Capture/docs/SPEC.md via MindAttic.Docs; synced automatically, so edit the repo, not this page.