This commit is contained in:
Alvin-Zilverstand committed 2026-09-09 10:21:29 +02:00
commit 42ef2f9674
468 files changed
+645161

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
# ClipForge Architecture
ClipForge is a Windows-first, local-first game clipping app scaffold. The code in this repository implements the testable core and app shell boundaries for a Medal/FTHR-style product without using game memory injection or anti-cheat-sensitive hooks.
## Runtime Shape
- Tauri shell hosts the frontend UI and calls Rust commands.
- Rust recorder service owns capture lifecycle, replay buffer, clip rendering, game integrations, upload adapters, and local storage.
- Windows capture should be implemented behind `CaptureBackend` using Windows Graphics Capture first, then DXGI/Desktop Duplication fallback.
- Encoding should prefer hardware H.264 through Media Foundation, with software H.264 as fallback.
- Audio should use WASAPI loopback for system/game audio and WASAPI input for mic, with mic disabled by default.
## Implemented Core
- Replay buffer window selection and pruning.
- Auto-clip event duplicate detection and merge-window policy.
- Game profile detection against process/window facts.
- Normalized event model for League Live Client Data and Valve GSI-style feeds.
- Upload adapter contracts for Catbox, Litterbox, Lustful, and custom HTTP.
- Local library path layout for clips, thumbnails, sessions, and buffer files.
## Next Native Work
1. Wire Tauri commands to the Rust library.
2. Replace capture stubs with Windows Graphics Capture and Media Foundation implementations.
3. Add SQLite persistence.
4. Add an HTTP client dependency for live upload adapters.
5. Package with installer and auto-update strategy.
+22
View File
@@ -0,0 +1,22 @@
# FFmpeg Installer Strategy
ClipForge should stay lightweight while still working for users who do not already have FFmpeg installed.
## Packaging Behavior
- `pnpm run prepare:ffmpeg` prepares `src-tauri/binaries/ffmpeg-x86_64-pc-windows-msvc.exe`.
- If `ffmpeg` is already on PATH, the script copies that binary into the sidecar location.
- If `ffmpeg` is missing, the script downloads the FFmpeg essentials zip and extracts `ffmpeg.exe` into the sidecar location.
- `src-tauri/tauri.conf.json` declares `bundle.externalBin = ["binaries/ffmpeg"]`, so Tauri includes the binary in MSI/NSIS installers.
- Installed users do not need a separate FFmpeg install; ClipForge can prefer system FFmpeg when present and fall back to the bundled sidecar.
## Why This Is Lightweight
Tauri uses the system WebView instead of bundling Chromium. FFmpeg is a single sidecar executable used only for capture/encoding work, not a persistent extra runtime.
## Build Commands
```powershell
pnpm run prepare:ffmpeg
pnpm run desktop:build
```
+43
View File
@@ -0,0 +1,43 @@
# ClipForge Implementation Status
## Working Now
- Rust core builds and passes tests.
- Tauri desktop shell checks, runs, and builds as a lightweight Windows WebView app.
- Windows MSI and NSIS installers build successfully.
- FFmpeg installer support is configured: `scripts/prepare-ffmpeg-sidecar.ps1` copies system FFmpeg if present or downloads an essentials build, and Tauri bundles it as `externalBin`.
- The installer bundles `ffmpeg-x86_64-pc-windows-msvc.exe`, so users do not need to install FFmpeg separately.
- Runtime FFmpeg detection checks the bundled sidecar first and then system PATH.
- Tauri commands exist for status, clip listing, manual clip creation, Start Capture, Stop Capture, clip delete, reveal in Explorer, trim, and upload queue marking.
- Start Capture launches FFmpeg `gdigrab` recording with a low-spec default profile: 720p30 at 6 Mbps using Media Foundation H.264 when available.
- Stop Capture asks FFmpeg to finalize gracefully, falls back after a short timeout, and adds the completed full-session MP4 to the local library.
- Clip detail actions are wired to the backend for Trim, Reveal, Upload, and Delete.
- Trim uses FFmpeg copy trimming to create a new local library clip when the source file exists.
- Replay buffer segment pruning and clip-window selection are implemented.
- Manual hotkey mapping is modeled and tested.
- Recorder service can start/stop sessions, retain buffer segments, create manual clip records, and create full-session bookmarks.
- Desktop UI calls Rust commands and displays FFmpeg/capture status.
- Event debouncing supports duplicate detection and merge-window behavior.
- League Live Client Data and Valve GSI-style events normalize into shared `GameEvent` records.
- Local clip library can add, filter, remove, update upload state, and write a tab-separated manifest.
- Storage layer creates the planned folders, sanitizes clip paths, writes placeholder clip files, and cleans oldest temporary files under a size limit.
- Upload adapter boundaries exist for Catbox, Litterbox, Lustful, and custom HTTP.
- Vite TypeScript UI builds and has interactive Library, Recording, Auto Clip, Uploads, and Settings views.
## Not Fully Working Yet
- Record button starts FFmpeg full-session desktop capture and saves the completed MP4 to the library, but instant replay clipping still writes placeholder clip files instead of extracting from the rolling video buffer while recording.
- Native Windows Graphics Capture is still a trait/stub boundary; FFmpeg `gdigrab` is the current MVP bridge.
- WASAPI audio capture is not implemented in native Rust yet; audio capture should be added either through FFmpeg device args or a Rust WASAPI layer.
- Global OS hotkey registration is modeled but not registered with Windows yet.
- SQLite persistence is still represented by a manifest-backed library.
- Live HTTP uploads are adapter stubs; the UI can mark an upload as queued, but real Catbox/Litterbox/custom HTTP transfer still needs an HTTP client implementation.
## Next Engineering Steps
1. Replace placeholder clip writer with FFmpeg segment extraction/concat from the recording file or rolling buffer segments.
2. Add optional FFmpeg audio device selection for system audio and mic.
3. Add SQLite migrations for clips, sessions, settings, and upload jobs.
4. Add global hotkey registration through a Tauri plugin or Windows API wrapper.
5. Add live Catbox/Litterbox/custom HTTP upload implementations.
6. Replace FFmpeg gdigrab with native Windows Graphics Capture for lower overhead after the MVP path is working.
+51
View File
@@ -0,0 +1,51 @@
# ClipForge Product Spec
## V1 Experience
ClipForge opens directly into the clipping app. The user sees recording state, detected game, library, and selected clip details without a marketing screen.
Default posture:
- Local-first.
- Accountless.
- Mic off.
- Upload off.
- Manual hotkey available for unsupported games.
- Event auto-clipping enabled only for integrations with validated local event sources.
## Recording States
- `WaitingForGame`: no matching profile is active.
- `Buffering`: a supported game is active and replay segments are rotating.
- `RecordingSession`: full-session recording is active.
- `Clipping`: an event or hotkey requested clip extraction.
- `Processing`: clip is being finalized, thumbnailed, trimmed, or uploaded.
- `StorageLow`: recording stops or refuses to start until space is freed.
## Auto Clip Policy
- Default pre-roll: 10 seconds.
- Default post-roll: 8 seconds.
- Merge events within 12 seconds for the same game/session.
- Duplicate event IDs are ignored.
- Full-session recording stores bookmarks instead of immediately rendering separate clips.
## Upload Policy
Uploading is optional and user initiated unless the user creates an explicit auto-upload rule.
Provider order for V1:
1. Catbox and Litterbox.
2. Custom HTTP uploader.
3. Lustful after its API details and limits are confirmed.
Failures should never delete the local clip. Upload history stores provider, status, link, attempt count, and last error.
## Non-Goals For This Scaffold
- Production Windows Graphics Capture implementation.
- Production Media Foundation encoder pipeline.
- SQLite migrations.
- Account system or social feed.
- AI visual highlight detection or voice command clipping.