Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

Merge remote-tracking branch 'origin/main' into codex/export-diagnostics

Yusuf Mohsinally2b8ec9e3a584
diff --cc src/components/video-editor/VideoEditor.tsx
index 7f021c79e,e1f6a60d9..fabdc251f
--- a/src/components/video-editor/VideoEditor.tsx
+++ b/src/components/video-editor/VideoEditor.tsx
@@@ -74,55 -81,9 +81,56 @@@ import
type ZoomFocusMode,
type ZoomRegion,
} from "./types";
+ import { UnsavedChangesDialog } from "./UnsavedChangesDialog";
import VideoPlayback, { VideoPlaybackRef } from "./VideoPlayback";
+interface ExportDiagnostics {
+ formatLabel: "GIF" | "Video";
+ reason?: string;
+ sourcePath?: string | null;
+ width?: number;
+ height?: number;
+ frameRate?: number;
+ codec?: string;
+ bitrate?: number;
+}
+
+function getFileNameForDiagnostics(filePath?: string | null) {
+ if (!filePath) return "unknown";
+
+ try {
+ const url = new URL(filePath);
+ if (url.protocol === "file:") {
+ return decodeURIComponent(url.pathname).split(/[\\/]/).pop() || filePath;
+ }
+ } catch {
+ // Treat non-URL values as filesystem paths.
+ }
+
+ return filePath.split(/[\\/]/).pop() || filePath;
+}
+
+function buildExportDiagnosticMessage(diagnostics: ExportDiagnostics) {
+ const details = [
+ diagnostics.reason ? `Reason: ${diagnostics.reason}` : null,
+ `Source: ${getFileNameForDiagnostics(diagnostics.sourcePath)}`,
+ diagnostics.width && diagnostics.height
+ ? `Output: ${diagnostics.width}x${diagnostics.height}${
+ diagnostics.frameRate ? ` @ ${diagnostics.frameRate} fps` : ""
+ }`
+ : null,
+ diagnostics.codec ? `Codec: ${diagnostics.codec}` : null,
+ diagnostics.bitrate ? `Bitrate: ${Math.round(diagnostics.bitrate / 1_000_000)} Mbps` : null,
+ `VideoEncoder: ${"VideoEncoder" in window ? "available" : "unavailable"}`,
+ ].filter(Boolean);
+
+ return `${diagnostics.formatLabel} export failed\n${details.join("\n")}`;
+}
+
+function buildSaveDiagnosticMessage(formatLabel: "GIF" | "Video", reason?: string) {
+ return `${formatLabel} export save failed${reason ? `\nReason: ${reason}` : ""}`;
+}
+
export default function VideoEditor() {
const {
state: editorState,
@@@ -1494,24 -1526,13 +1583,25 @@@
setUnsavedExport(null);
handleExportSaved("GIF", saveResult.path);
} else {
+ setUnsavedExport({ arrayBuffer, fileName: targetFileName, format: "gif" });
- setExportError(saveResult.message || "Failed to save GIF");
- toast.error(saveResult.message || "Failed to save GIF");
+ const message = buildSaveDiagnosticMessage(
+ "GIF",
+ saveResult.message || "Failed to save GIF",
+ );
+ setExportError(message);
+ toast.error(message);
}
} else {
- setExportError(result.error || "GIF export failed");
- toast.error(result.error || "GIF export failed");
+ const message = buildExportDiagnosticMessage({
+ formatLabel: "GIF",
+ reason: result.error || "GIF export failed",
+ sourcePath: videoSourcePath ?? videoPath,
+ width: settings.gifConfig.width,
+ height: settings.gifConfig.height,
+ frameRate: settings.gifConfig.frameRate,
+ });
+ setExportError(message);
+ toast.error(message);
}
} else {
// MP4 Export
@@@ -1648,26 -1667,13 +1736,27 @@@
setUnsavedExport(null);
handleExportSaved("Video", saveResult.path);
} else {
+ setUnsavedExport({ arrayBuffer, fileName: targetFileName, format: "mp4" });
- setExportError(saveResult.message || "Failed to save video");
- toast.error(saveResult.message || "Failed to save video");
+ const message = buildSaveDiagnosticMessage(
+ "Video",
+ saveResult.message || "Failed to save video",
+ );
+ setExportError(message);
+ toast.error(message);
}
} else {
- setExportError(result.error || "Export failed");
- toast.error(result.error || "Export failed");
+ const message = buildExportDiagnosticMessage({
+ formatLabel: "Video",
+ reason: result.error || "Export failed",
+ sourcePath: videoSourcePath ?? videoPath,
+ width: exportWidth,
+ height: exportHeight,
+ frameRate: 60,
+ codec: "avc1.640033",
+ bitrate,
+ });
+ setExportError(message);
+ toast.error(message);
}
}