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.

The Flashback clip library aggregates MP4 files from one or more directories on disk and exposes them to the frontend through a small set of Tauri commands. The library model is append-only: changing the active clips directory only redirects where new clips are saved — older directories continue to be scanned so no recordings are hidden after a directory change. This page documents every library command, the ClipInfo type they return, and TypeScript examples drawn from the real frontend code in src/lib/library.svelte.ts.
pick_folder uses the Windows COM IFileOpenDialog shell API and is Windows-only. All other library commands are cross-platform (though Flashback currently only ships on Windows).

ClipInfo

Every command that returns clips produces objects of this shape.
ClipInfo
object

Listing Clips

list_clips

Scans all library directories and returns the full list of MP4 clips, sorted by last-modified time (newest first). Duplicate paths across directories are deduplicated (case-insensitive on Windows). Non-MP4 files and directories are silently skipped. The scanned directories include: the active clips directory, the default Videos\Flashback\Clips location, the legacy AppData\Roaming\…\clips path (for backwards compatibility), the Clips-Edit directory for exported clips, and any additional directories added via set_clips_dir. Returns ClipInfo[]
import { invoke } from '@tauri-apps/api/core';

const clips = await invoke<ClipInfo[]>('list_clips');
console.log(`Library has ${clips.length} clip(s)`);

for (const clip of clips) {
  console.log(clip.name, clip.source, `${(clip.duration_sec).toFixed(1)}s`);
}

Directory Management

clips_dir

Returns the current active clips directory — the folder where new recordings are saved. This is either the user-configured directory (if one has been set) or the default Videos\Flashback\Clips path. Returns string — absolute path to the active clips directory.
const dir = await invoke<string>('clips_dir');
console.log('Saving clips to:', dir);

set_clips_dir

Changes the active clips directory to dir. Creates the directory if it does not exist. Adds dir to the library history so that clips already saved there continue to appear in list_clips even after the directory is changed again. Also updates the Tauri asset-protocol scope so the WebView can load media files from the new path.
dir
string
required
Absolute path to the new clips directory. Use pick_folder to let the user choose interactively.
Returns Result<void, string> — rejects if the directory cannot be created.
await invoke<void>('set_clips_dir', { dir: 'D:\\GameCaptures' });

pick_folder

Opens the native Windows folder picker dialog (IFileOpenDialog) and returns the path the user chose, or null if the dialog was cancelled. Runs on a blocking thread to avoid blocking Tauri’s async runtime. Returns Result<string | null, string>
const dir = await invoke<string | null>('pick_folder');
if (dir) {
  await invoke<void>('set_clips_dir', { dir });
}
pick_folder uses CoInitializeEx(COINIT_APARTMENTTHREADED) internally. It must be called from outside any MTA COM context. This is the case for all normal Tauri command invocations from the frontend.

Clip Operations

rename_clip

Renames an MP4 clip and any associated sidecar files (.clip.json, .edit.json) in one atomic filesystem operation. Also re-keys the clip’s entry in the central edit index so that non-destructive edits survive the rename. Returns the new absolute path of the MP4.
The new_name parameter is the bare stem — do not include the .mp4 extension or a directory path. Flashback validates the name and rejects characters that are invalid in Windows filenames (/ \ : * ? " < > |) or an empty string.
path
string
required
Absolute path to the existing MP4 file.
new_name
string
required
New filename stem, without extension (e.g. "Epic_Clutch_Round_14").
Returns Result<string, string> — the new absolute path of the renamed MP4, or an error message if the name is invalid or a file with the new name already exists.
const newPath = await invoke<string>('rename_clip', {
  path: 'C:\\Users\\Alice\\Videos\\Flashback\\Clips\\old_name.mp4',
  new_name: 'epic_clutch'
});
console.log('Renamed to:', newPath);
// → "C:\Users\Alice\Videos\Flashback\Clips\epic_clutch.mp4"

delete_clip

Sends an MP4 clip and its sidecar files to the Windows Recycle Bin (SHFileOperationW with FOF_ALLOWUNDO). The deletion is reversible from the Recycle Bin. Also removes the clip’s entry from the central edit index.
On non-Windows platforms (where SHFileOperationW is not available) the files are permanently deleted with std::fs::remove_file. There is no undo.
path
string
required
Absolute path to the MP4 file to delete.
Returns Result<void, string> — rejects if the shell operation returns a non-zero error code.
await invoke<void>('delete_clip', {
  path: 'C:\\Users\\Alice\\Videos\\Flashback\\Clips\\old_clip.mp4'
});
// File is now in the Recycle Bin

Export Destination Helper

edit_dest

Computes the canonical export destination path for a clip without writing anything. Exported clips are placed in the dedicated Clips-Edit directory (Videos\Flashback\Clips-Edit) with a _edit.mp4 suffix, keeping them separate from originals while still making them visible in the library. This command is documented here because the library scans Clips-Edit automatically, but it is also used by the editor workflow. See Editor Commands for the full export flow.
src
string
required
Absolute path to the source MP4 clip.
Returns string — the absolute destination path.
const dst = await invoke<string>('edit_dest', { src: clip.path });
// → "C:\Users\Alice\Videos\Flashback\Clips-Edit\myclip_edit.mp4"

Full Library Refresh Example

The following pattern mirrors the refreshLibrary function in src/lib/library.svelte.ts:
import { invoke, convertFileSrc } from '@tauri-apps/api/core';

type ClipInfo = {
  id: string;
  name: string;
  path: string;
  size_bytes: number;
  modified_ms: number;
  duration_sec: number;
  source: string;
};

async function refreshLibrary(): Promise<ClipInfo[]> {
  const clips = await invoke<ClipInfo[]>('list_clips');
  // clips is already sorted newest-first by the backend
  return clips;
}

// Request a thumbnail for a clip card (cached by the backend)
async function getThumb(path: string): Promise<string | null> {
  try {
    const thumbPath = await invoke<string>('clip_thumbnail', { path });
    return convertFileSrc(thumbPath); // asset-protocol URL for the WebView
  } catch {
    return null;
  }
}

Clip Library

User-facing guide to the clip library and filtering.

Storage Configuration

How to configure the clips directory and manage library paths.

Editor Commands

Commands for editing clips once they are in the library.

Capture Commands

Commands for recording new clips into the library.

Game Detection

How the source field is populated for library entries.

Architecture

High-level overview of how the library integrates with the rest of Flashback.

Build docs developers (and LLMs) love