Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/CaramelHQ/Flashback/llms.txt

Use this file to discover all available pages before exploring further.

Flashback exposes its capture subsystem to the SvelteKit frontend through a set of Tauri commands registered in src-tauri/src/lib.rs. All capture work runs on dedicated background threads using Windows Graphics Capture (WGC) and Media Foundation — the frontend simply calls invoke() to start, stop, and query these pipelines. This page documents every capture-related command, the shapes of the data they return, and shows working TypeScript examples for the most common patterns.
All capture and replay commands are Windows-only. On non-Windows platforms the commands resolve immediately: list_monitors and list_audio_inputs return empty arrays, start_capture and start_replay return an error string, and stop_capture / save_replay return null.

Monitors & Audio

list_monitors

Returns metadata for every display currently attached to the system, including a base64-encoded thumbnail of its current content. Use this list to populate the capture-target picker. Returns MonitorInfo[]
MonitorInfo
object
import { invoke } from '@tauri-apps/api/core';

const monitors = await invoke<MonitorInfo[]>('list_monitors');
const primary = monitors.find(m => m.primary);
console.log('Primary monitor:', primary?.label, primary?.width, 'x', primary?.height);

list_audio_inputs

Returns all audio capture (microphone) devices registered with Windows. Device enumeration is performed via WinRT DeviceInformation and does not require the microphone privacy permission. Returns AudioInput[]
AudioInput
object
const inputs = await invoke<AudioInput[]>('list_audio_inputs');
inputs.forEach(d => console.log(d.id, d.name));

Recording

start_capture

Starts a manual recording session. Flashback opens a WGC capture session on the requested target, builds a Media Foundation IMFSinkWriter pipeline with an H.264 hardware encoder (NVENC / AMF / Quick Sync, with software fallback), and begins writing an MP4 file to the configured clips directory. The command returns as soon as the pipeline is confirmed ready; if the encoder or WGC session fails to open the promise rejects with an error string.
Only one recording or replay session can be active at a time. Calling start_capture while already recording is a no-op (returns Ok(())). Stop the current session with stop_capture before starting a new one.
target
string
required
The capture target. Pass a MonitorInfo.id value from list_monitors to capture a specific display, or "window" to capture the active game window detected by the overlay (used internally; prefer monitor IDs from user-facing UI).
fps
number
required
Target frame rate. Clamped internally to a safe range (e.g. 1–240). Typical values: 30, 60.
quality
string
required
Bitrate quality preset. Accepted values: "low", "medium", "high", "ultra". Controls a bitrate multiplier applied on top of the bitrate parameter.
resolution
number
required
Output vertical resolution in pixels (e.g. 720, 1080, 1440). The capture always happens at native resolution; the encoder downscales to this target using the GPU video processor.
bitrate
number
required
Base target video bitrate in bits per second (e.g. 50_000_000 for 50 Mbps). The quality multiplier is applied on top of this value.
mic
boolean
required
Whether to capture a microphone track alongside the system audio loopback.
mic_device
string
required
The AudioInput.id of the microphone to capture. Pass an empty string when mic is false.
Returns Result<void, string> — resolves when the pipeline is ready; rejects with a human-readable error message on failure.
import { invoke } from '@tauri-apps/api/core';

await invoke<void>('start_capture', {
  target: 'monitor:primary',   // from list_monitors()
  fps: 60,
  quality: 'high',
  resolution: 1080,
  bitrate: 50_000_000,
  mic: true,
  mic_device: '{0.0.1.00000000}.{...}' // from list_audio_inputs()
});

stop_capture

Signals the capture pipeline to stop, flushes and finalises the MP4 muxer, and returns the path of the saved file. Call this to end a recording started with start_capture. Returns string | null — the absolute Windows path of the saved MP4, or null if no recording was active or if the muxer could not be finalised.
const path = await invoke<string | null>('stop_capture');
if (path) {
  console.log('Saved to:', path);
}

capture_status

Returns a snapshot of the currently active recording pipeline. Poll this (e.g. every second) to update a live recording indicator. Returns CaptureStatus
CaptureStatus
object
const status = await invoke<CaptureStatus>('capture_status');
if (status.running) {
  console.log(`Recording for ${status.seconds.toFixed(1)}s — ${status.frames} frames`);
}

Instant Replay

start_replay

Starts a continuous background encoding loop that keeps the last seconds seconds of gameplay in an in-memory ring buffer. Frames are encoded to H.264 in real time so that saving a replay requires only a fast mux — no re-encoding. The function returns once the WGC session and encoder pipeline are confirmed ready.
In window mode (target: "window") the replay arms itself even if the game is not yet running or is minimised. It will reconnect automatically when the game window becomes capturable. In monitor mode a startup error is fatal.
target
string
required
Capture target — a MonitorInfo.id or "window" for game-window mode.
seconds
number
required
Size of the replay ring buffer in seconds (e.g. 30, 60, 120).
fps
number
required
Encoding frame rate for the replay buffer.
quality
string
required
Bitrate quality preset ("low", "medium", "high", "ultra").
resolution
number
required
Output vertical resolution in pixels.
bitrate
number
required
Base target video bitrate in bits per second.
mic
boolean
required
Whether to include a microphone track in the replay.
mic_device
string
required
AudioInput.id of the microphone, or an empty string if mic is false.
Returns Result<void, string>
await invoke<void>('start_replay', {
  target: monitors[0].id,
  seconds: 30,
  fps: 60,
  quality: 'high',
  resolution: 1080,
  bitrate: 50_000_000,
  mic: false,
  mic_device: ''
});

stop_replay

Tears down the replay pipeline and discards the ring buffer. Any unsaved replay data is lost. Returns void
await invoke<void>('stop_replay');

save_replay

Muxes the current ring buffer contents into an MP4 file, starting from the most recent keyframe at the beginning of the buffer window. This operation is fast (no re-encoding) and runs on a dedicated MTA thread so it does not block the UI.
Returns null (without saving a file) if the buffer contains no keyframe yet. This can happen if save_replay is called within the first GOP interval (roughly 2 seconds) of starting the replay. Check the return value before assuming a file was saved.
source
string
required
The game or capture source name (e.g. the value from detect_game().name). This string is embedded into the MP4 as metadata so the clip appears under the correct game label in the library. Pass an empty string to omit the metadata.
Returns string | null — absolute path of the saved MP4, or null on failure.
const game = await invoke<DetectedGame | null>('detect_game');
const path = await invoke<string | null>('save_replay', {
  source: game?.name ?? ''
});
if (path) {
  console.log('Replay saved to', path);
}

replay_active

Returns whether the instant-replay pipeline is currently running. Returns boolean
const active = await invoke<boolean>('replay_active');

Game Detection

detect_game

Checks whether a known game is currently the foreground application. Detection uses a combination of window title matching and Steam AppID resolution. Returns DetectedGame | null
DetectedGame
object
const game = await invoke<DetectedGame | null>('detect_game');
if (game) {
  console.log('Playing:', game.name, game.steam_appid ?? '(non-Steam)');
}

get_seen_games

Returns the list of all games that Flashback has detected at least once, sorted by most-recently-seen. Useful for building game-history pickers. Returns SeenGame[]
SeenGame
object
const games = await invoke<SeenGame[]>('get_seen_games');

get_disabled_games

Returns the list of game names for which automatic game detection has been disabled by the user. Returns string[]
const disabled = await invoke<string[]>('get_disabled_games');

set_disabled_games

Persists a new list of game names for which automatic detection should be suppressed. Replace the entire list on each call.
games
string[]
required
Array of canonical game names to disable. Pass an empty array to re-enable detection for all games.
Returns Result<void, string>
await invoke<void>('set_disabled_games', { games: ['Minecraft'] });

Artwork

Flashback fetches game artwork from Steam’s CDN and caches it locally. Both commands return a base64-encoded data URL that can be set directly as an <img src>.

game_hero

Returns the hero / banner image for a game (the wide banner used on Steam store pages and in the Flashback library header).
name
string
required
Canonical game name.
steam_appid
number | null
required
Steam AppID, or null for non-Steam games.
Returns string | null — base64 data URL of the image, or null if unavailable.
const hero = await invoke<string | null>('game_hero', {
  name: 'VALORANT',
  steam_appid: null
});
if (hero) imgEl.src = hero;

game_icon

Returns the small square icon for a game (used in clip cards and list rows).
name
string
required
Canonical game name.
steam_appid
number | null
required
Steam AppID, or null for non-Steam games.
Returns string | null — base64 data URL of the icon, or null if unavailable.
const icon = await invoke<string | null>('game_icon', {
  name: 'Counter-Strike 2',
  steam_appid: 730
});

Encoder

get_encoder

Returns the user’s current hardware encoder preference. Returns string — one of "Auto", "NVENC", "AMF", "Quick Sync", or "Software".
const enc = await invoke<string>('get_encoder');
console.log('Encoder preference:', enc);

set_encoder

Persists the hardware encoder preference. Takes effect on the next start_capture or start_replay call.
enc
string
required
Encoder preference. Must be one of "Auto", "NVENC", "AMF", "Quick Sync", or "Software".
Returns Result<void, string>
await invoke<void>('set_encoder', { enc: 'NVENC' });
"Auto" lets Media Foundation select the best available hardware encoder. Use a specific vendor string only if you need to override the selection, for example to prefer AMD AMF on a system with both AMD and NVIDIA GPUs.

Notifications

toast

Displays a brief notification in the Flashback overlay window (the always-on-top, click-through transparent window used during gameplay). The overlay window repositions itself to the top-right corner of the primary monitor on each call. The overlay is non-activatable so it never steals focus from a game.
text
string
required
The notification message to display (e.g. "Replay saved").
kind
string
required
Visual style hint. Typical values: "success", "error", "info".
Returns Result<void, string>
await invoke<void>('toast', { text: 'Replay saved!', kind: 'success' });

dismiss_toast

Hides the overlay notification window immediately, without waiting for the auto-dismiss timer in the overlay’s web content. Returns void
await invoke<void>('dismiss_toast');

Capture Pipeline

Deep-dive into WGC frame delivery, CFR pacing, and the Media Foundation encoder chain.

Audio Pipeline

How system loopback and microphone tracks are captured, encoded, and muxed.

Manual Recording

User-facing guide to starting and stopping recordings.

Instant Replay

User-facing guide to the instant-replay feature.

Encoder Configuration

How to choose and configure the hardware encoder.

Editor Commands

Commands for editing captured clips.

Build docs developers (and LLMs) love