Files
Recordly/scripts/benchmark-export-queues/fixtures.mjs
webadderall 5d040fbf2c refactor: split large files into focused modules
Split all source files exceeding 500 lines into smaller, focused modules:

- electron/main.ts → mainBootstrapHelpers, mainRuntimeState, mainUpdateIntegration, mainWindowControls
- electron/windows.ts → editorWindows, hudWindows, windowShared
- electron/updater.ts → updaterDialogs, updaterEventHandlers, updaterShared
- electron/preload.ts → preloadExtensionsBridge, preloadUpdateBridge
- electron/ipc/register/recording.ts → recording/ directory with focused handlers
- src/components/video-editor/VideoEditor.tsx → EditorContent, EditorHeader, EditorSidebar, EditorToolbar, hooks/
- src/components/video-editor/SettingsPanel.tsx → settings/ directory with per-section components
- src/components/video-editor/AnnotationSettingsPanel.tsx → tab components
- src/components/video-editor/ExtensionManager.tsx → extension-manager/ directory
- src/components/video-editor/VideoPlayback.tsx → videoPlaybackComponent/ directory
- src/components/video-editor/projectPersistence.ts → projectPersistence{Normalization,Paths,Regions,Shared}.ts
- src/components/video-editor/timeline/TimelineEditor.tsx → TimelineEditor/ directory
- src/components/video-editor/types.ts → focused type modules
- src/components/launch/LaunchWindow.tsx → LaunchWindow/ directory
- src/hooks/useScreenRecorder.ts → useScreenRecorder/ directory
- src/lib/exporter/audioEncoder.ts → audioEncoder/ directory
- src/lib/exporter/frameRenderer.ts → frameRenderer modules
- src/lib/exporter/modernFrameRenderer.ts → filters and lifecycle modules
- src/lib/exporter/modernVideoExporter.ts → modernVideoExporter/ directory
- src/lib/exporter/videoExporter.ts → video-exporter/ directory
- src/lib/exporter/streamingDecoder.ts → streamingDecoderHelpers.ts
- src/lib/extensions/extensionHost.ts → extensionHost{ApiFactory,QueryApi,RegistrationApi,Shared,State}.ts
- src/lib/extensions/types.ts → focused type modules
- electron/native/ScreenCaptureKitRecorder.swift → ScreenCaptureKitRecorder/ directory
- scripts/benchmark-export-queues.mjs → benchmark-export-queues/ directory
- .github/workflows/release.yml → extracted merge-macos-metadata composite action
- scripts/build-native-helpers.mjs → updated for multi-file Swift compilation

Also incorporates upstream default export quality change (good → source).
2026-04-20 20:41:42 +10:00

99 lines
2.0 KiB
JavaScript

import { execFile } from "node:child_process";
import fs from "node:fs/promises";
import { promisify } from "node:util";
const execFileAsync = promisify(execFile);
export async function ensureBuildArtifacts(config) {
await fs.access(config.mainEntry);
await fs.access(config.rendererEntry);
}
export async function createFixtureVideo(ffmpegPath, targetPath, options) {
const {
durationSeconds,
frameRate,
fixtureWidth,
fixtureHeight,
includeAudio = true,
videoFilter = `testsrc2=size=${fixtureWidth}x${fixtureHeight}:rate=${frameRate}`,
} = options;
const args = ["-y", "-hide_banner", "-loglevel", "error", "-f", "lavfi", "-i", videoFilter];
if (includeAudio) {
args.push(
"-f",
"lavfi",
"-i",
"sine=frequency=880:sample_rate=48000",
"-c:a",
"aac",
"-b:a",
"128k",
);
} else {
args.push("-an");
}
args.push(
"-t",
String(durationSeconds),
"-c:v",
"libx264",
"-preset",
"veryfast",
"-pix_fmt",
"yuv420p",
"-movflags",
"+faststart",
targetPath,
);
await execFileAsync(ffmpegPath, args, {
timeout: 60_000,
maxBuffer: 20 * 1024 * 1024,
});
}
function parseDurationSeconds(ffmpegOutput) {
const match = ffmpegOutput.match(/Duration:\s*(\d+):(\d+):(\d+(?:\.\d+)?)/i);
if (!match) {
return null;
}
return (
Number.parseInt(match[1], 10) * 3600 +
Number.parseInt(match[2], 10) * 60 +
Number.parseFloat(match[3])
);
}
export async function inspectOutput(ffmpegPath, targetPath) {
try {
const { stderr } = await execFileAsync(
ffmpegPath,
["-hide_banner", "-i", targetPath, "-f", "null", "-"],
{
timeout: 30_000,
maxBuffer: 20 * 1024 * 1024,
},
);
return parseDurationSeconds(stderr);
} catch (error) {
return parseDurationSeconds(String(error?.stderr ?? ""));
}
}
export async function readSmokeExportReport(outputPath) {
const reportPath = `${outputPath}.report.json`;
try {
const reportContent = await fs.readFile(reportPath, "utf8");
return {
reportPath,
report: JSON.parse(reportContent),
};
} catch {
return null;
}
}