Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xsline OpenChatCut AnalyzeExportFile

From Leeroopedia
Knowledge Sources
Domains Quality_Assurance, Video_Export, Media_Analysis
Last Updated 2026-10-22 14:00 GMT

Overview

Concrete function that analyzes a rendered export file for black frames, frozen video, silence, and volume issues using FFmpeg filters, then generates a contact-sheet JPEG of cut-point evidence.

Description

The analyzeExportFile function runs post-render quality assurance:

  • Probes the file with `probeMedia` to determine video/audio presence, duration, and dimensions.
  • Video analysis: Runs `ffmpeg` with `blackdetect` and `freezedetect` filters (only if video stream exists).
  • Audio analysis: Runs `ffmpeg` with `silencedetect` and `volumedetect` filters (only if audio stream exists).
  • Log parsing: Parses FFmpeg stderr output via `parseExportQaLog` into structured findings.
  • Quality assessment: Combines probe data and parsed findings via `assessExportQuality` into a report with quality risks.
  • Cut evidence: Generates a tiled contact-sheet JPEG of frames at expected cut times (up to `maxEvidenceCuts` frames, default 8).
  • Returns: A `{ report, evidence }` object with the structured QA report and binary JPEG evidence.

The QA plugin (`exportQaPlugin`) wraps this function as an HTTP endpoint at `/api/export-qa`.

Usage

  • Export QA stage: Called after rendering to validate output quality.
  • Automated checks: The export pipeline calls QA automatically and surfaces risks to the user.
  • Human review: The contact-sheet JPEG provides visual evidence for manual verification.

Code Reference

Source Location

  • Repository: OpenChatCut
  • File:*** server/plugins/export-qa.ts

Signature

export interface AnalyzeExportFileOptions extends ExportQaExpectations {
  cutTimesSeconds?: number[];
  maxEvidenceCuts?: number;
}

export async function analyzeExportFile(
  file: string,
  options: AnalyzeExportFileOptions,
): Promise<{ report: ExportQaAnalysis; evidence: { base64?: string; samples: ...[] } }>;

export function exportQaPlugin(): Plugin;

Import

import { analyzeExportFile, type AnalyzeExportFileOptions } from '../server/plugins/export-qa.ts';

I/O Contract

Inputs

Name Type Required Description
file string Yes Path to the rendered export file
options.durationSeconds number Yes Expected duration in seconds
options.width number Yes Expected video width
options.height number Yes Expected video height
options.fps number Yes Expected frame rate
options.expectsAudio boolean Yes Whether audio is expected
options.cutTimesSeconds number[] No Cut times for evidence frames (default [])
options.maxEvidenceCuts number No Max evidence frames (default 8)

Outputs

Name Type Description
report ExportQaAnalysis Structured QA findings (black, freeze, silence, volume)
evidence.base64 string Optional: contact-sheet JPEG as base64
evidence.samples array Per-cut evidence frame metadata

Usage Examples

Analyze a Rendered Export

import { analyzeExportFile } from '../server/plugins/export-qa.ts';

const { report, evidence } = await analyzeExportFile(
  '/tmp/exports/output.mp4',
  {
    durationSeconds: 120,
    width: 1920,
    height: 1080,
    fps: 30,
    expectsAudio: true,
    cutTimesSeconds: [5.0, 30.0, 60.0, 90.0],
    maxEvidenceCuts: 4,
  },
);

console.log('Quality risks:', report.qualityRisks);
if (evidence.base64) {
  // Contact-sheet JPEG available for UI display
  console.log(`Evidence: ${evidence.base64.length} chars of JPEG`);
}

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment