29 Commits
Author SHA1 Message Date
webadderall 04cf058ad0 feat(library): add recording storage, thumbnails and sequence imports 2026-09-20 18:52:26 +10:00
webadderall 10ecb70141 Remove unsupported VRAM diagnostics 2026-09-11 19:41:17 +10:00
webadderall 570d5472a0 Collect complete GPU details for export reports 2026-09-11 18:22:09 +10:00
webadderall 0b1b2596bb Add computer hardware to export diagnostics 2026-09-11 18:12:23 +10:00
wiiiii123 fe828433ad fix(recording): stabilize capture quality and CUDA export canvas 2026-05-27 18:12:21 +07:00
wiiiii123 c85dc8b156 feat(export): add nvidia opt-in detection 2026-05-22 20:27:40 +07:00
wiiiii123 591fde8e37 fix(export): tighten native audio safety guards 2026-05-22 20:00:24 +07:00
wiiiii123 e540615a1f fix(export): gate packaged cuda audio fallback 2026-05-22 19:56:15 +07:00
wiiiii123 61bbaab7da fix(export): reject silent cuda inline audio 2026-05-22 19:51:18 +07:00
wiiiii123 31eb0ecc84 refactor(export): add native static route plan 2026-05-22 18:55:03 +07:00
wiiiii123 211d6165f9 merge main into beta/pr410-native-gpu-export-test
# Conflicts:
#	electron/ipc/project/manager.ts
#	electron/ipc/register/export.ts
#	src/lib/exporter/modernVideoExporter.ts
2026-05-08 10:44:13 +07:00
webadderall 25cd1f2f75 Speed up Lightning export and relax local media reads 2026-05-08 11:32:04 +10:00
wiiiii123 234a7b537a fix(export): support native cropped layouts 2026-05-08 03:20:28 +07:00
wiiiii123 eab365d115 fix(export): enable native speed timelines 2026-05-08 02:28:35 +07:00
wiiiii123 254783b15f fix(export): gate native speed timelines 2026-05-08 00:39:14 +07:00
wiiiii123 3455475f38 fix(export): harden native beta pipeline 2026-05-07 22:37:27 +07:00
wiiiii123 115ecba7c5 fix(recording): reduce native mic noise amplification 2026-05-07 03:29:58 +07:00
wiiiii123 eb1ea68f7e fix(export): support native background blur 2026-05-06 20:53:44 +07:00
wiiiii123 b3862bde79 fix(export): allow native cursor overlay routing 2026-05-06 07:04:01 +07:00
wiiiii123 9ac4c55ccf feat(export): prepare native GPU beta candidate
Add validated native CUDA/D3D11 timeline retime, pause-aware capture timing, webcam source-time sampling, edited-track audio duration padding, packaged helper updates, and focused tests for PR #410 tester branch.
2026-05-06 01:50:12 +07:00
wiiiii123 23f17f2772 Merge main into native GPU export PR 2026-05-04 11:42:27 +07:00
wiiiii123 94bbd0280f Add NVIDIA CUDA export compositor 2026-05-04 09:59:41 +07:00
wiiiii123 9c81006e5c Add native GPU static layout export path 2026-05-03 22:43:23 +07:00
shafeq 01f61dfada fix(export): return temp path from buffer-mode FFmpeg muxer (>2 GiB)
Exports of recordings whose muxed output exceeds 2 GiB failed with
RangeError [ERR_FS_FILE_TOO_LARGE]: Node's fs.readFile rejects files
larger than kIoMaxLength (2 ** 31 - 1). The legacy export pipeline hit
this in muxExportedVideoAudioBuffer, which called
  await fs.readFile(finalized.outputPath)
to ship the muxed bytes back to the renderer.

Mirror the path-based contract that mux-exported-video-audio-from-path
already uses:

- muxExportedVideoAudioBuffer now returns { outputPath, metrics } and
  collects byte size via fs.stat instead of fs.readFile. The unmuxed
  intermediate is still cleaned up; the muxed output is left for the
  IPC handler to register and the renderer to finalize.
- The mux-exported-video-audio IPC handler registers the muxed output
  via registerOwnedExportPath and returns { tempPath, metrics }.
- preload.ts and electron-env.d.ts: tempPath replaces data in the
  renderer-facing return type.
- videoExporter.ts and modernVideoExporter.ts (the
  finalizeExportWithFfmpegAudio fallback paths) now return
  { tempFilePath } so VideoEditor's existing finalize-exported-video
  flow handles the move — the same path the modern stream-mode export
  already takes.

The renderer already preferred tempFilePath over blob in
VideoEditor.tsx for MP4 saves (with the explicit comment "avoids ever
allocating a multi-GiB ArrayBuffer in the renderer"), so this just
removes the buffer-mode regression for large legacy exports.

Adds electron/ipc/export/native-video.test.ts asserting the new
contract: muxExportedVideoAudioBuffer returns a path, never calls
fs.readFile, and still records muxedVideoBytes via stat.

Closes #380
2026-05-02 09:48:05 +08:00
大彪 9ac4dbd2e8 fix(export): stream MP4 output to disk to unblock >2 GiB exports
Long recordings (35-minute screencaps were the motivating case) fail at
the 99% "Finalizing" step with a RangeError once the muxed MP4 would
exceed V8's ~2 GiB per-ArrayBuffer limit. Both export paths accumulate
the whole file in renderer memory and round-trip it through IPC, so no
output size past that point can complete:

- Legacy: src/lib/exporter/muxer.ts uses mediabunny's BufferTarget,
  which holds the entire MP4 in a single ArrayBuffer. finalize() → Blob
  → blob.arrayBuffer() → ipcRenderer.invoke('write-exported-video-to-
  path', arrayBuffer, path) — every step wants a ≥2 GiB contiguous
  allocation.
- Lightning: native-video-export-finish did fs.readFile(finalizedPath)
  and shipped the bytes back to the renderer, which re-serialized them
  again. Same ceiling.

This change moves the finished MP4 across the renderer↔main boundary
via a temp file instead of an ArrayBuffer:

- New electron/ipc/export/exportStream.ts manages streaming temp files
  via fh.write(buf, 0, len, position) so out-of-order writes (moov box
  rewrites, etc.) stay safe. Each session lives in a 0700 mkdtemp()
  directory opened with O_CREAT | O_EXCL so a hostile local user on a
  shared tempdir cannot pre-plant a symlink at the predicted path.
- New renderer-facing IPCs: export-stream-open/write/close,
  finalize-exported-video (renames temp to final path, copy+unlink
  fallback on EXDEV/EPERM/ENOTEMPTY with console.warn on leaked bytes),
  mux-exported-video-audio-from-path (FFmpeg audio fallback that takes
  a path instead of an ArrayBuffer), and discard-exported-temp. Every
  handler validates the caller-supplied path against an owned-export-
  paths registry before touching disk, so a compromised renderer cannot
  route arbitrary filesystem paths into main-process deletes/moves.
- The muxer now picks mediabunny's StreamTarget automatically when the
  Electron bridge is available (BufferTarget stays for tests and any
  non-Electron callers). finalize() returns { mode, tempFilePath,
  bytesWritten } or { mode, blob } so the exporter can branch.
- Exporters forward tempFilePath through ExportResult. Lightning's
  finish returns the ffmpeg temp path directly; the FFmpeg audio
  fallback forks on the muxer result type. modernVideoExporter's
  Lightning success branch now accepts tempFilePath (previously it
  checked blob only, which regressed every native export).
- VideoEditor.tsx dispatches on tempFilePath: finalize via the new IPC,
  keep the temp in place when the save dialog is canceled so "Save
  Again" still works without re-rendering, keep the pending-save entry
  alive on non-canceled save failures, and discard the temp on unmount
  or explicit clear. GIF and smoke-test code paths still use the
  legacy Blob path unchanged.
- app.on('before-quit') also reaps any open streaming sessions via
  cleanupAllExportStreams().

Chunk size is 16 MiB — well under Electron/Mojo IPC message limits
while keeping total writes low (~160 for a 2.5 GB export).

Tested locally: exported a 35:13 source (~2.7 GiB H.264 input) at
Original 1920×1080 + Balanced. Previously failed on finalize with a
RangeError; with this patch the Legacy pipeline produced a valid 3.7
GiB MP4 whose ffmpeg -i duration/streams match the source.

Addresses #194.
2026-04-24 16:02:37 +08:00
wiiiii123 fcdc842371 fix(export): fast-path simple edited audio tracks 2026-04-21 18:09:23 +07:00
wiiiii123 b7e5a4ab79 chore(export): add ffmpeg mux timing breakdown 2026-04-20 20:09:54 +07:00
webadderall 0b3169ffff fix: address ipc review follow-ups 2026-04-17 21:11:58 +10:00
webadderall 099ce2bbb5 refactor: split handlers.ts into focused sub-modules
handlers.ts was ~5967 lines. Extracted into 22 focused modules:

- ipc/types.ts — shared TypeScript interfaces and types
- ipc/constants.ts — module-level constants
- ipc/state.ts — all mutable state with typed setters
- ipc/utils.ts — shared low-level utilities (getScreen, normalizePath, etc.)
- ipc/ffmpeg/binary.ts — ffmpeg binary resolution
- ipc/ffmpeg/filters.ts — audio sync/filter builders
- ipc/captions/parser.ts — SRT/Whisper JSON parsers
- ipc/captions/whisper.ts — Whisper model download/status
- ipc/captions/generate.ts — auto-caption generation
- ipc/paths/binaries.ts — native binary path resolution
- ipc/cursor/monitor.ts — cursor monitor process management
- ipc/cursor/telemetry.ts — cursor sampling and telemetry
- ipc/cursor/bounds.ts — window bounds capture and resolution
- ipc/cursor/interaction.ts — mouse hook and interaction capture
- ipc/recording/events.ts — recording lifecycle events
- ipc/recording/diagnostics.ts — media validation and diagnostics
- ipc/recording/prune.ts — auto-recording cleanup
- ipc/recording/ffmpeg.ts — FFmpeg screen capture
- ipc/recording/windows.ts — Windows native capture (WGC)
- ipc/recording/mac.ts — Mac ScreenCaptureKit integration
- ipc/export/native-video.ts — native video export sessions
- ipc/project/session.ts — recording session manifests
- ipc/project/manager.ts — project library and file management

handlers.ts reduced from 5967 → 2930 lines (registerIpcHandlers + helpers only)
2026-04-17 19:57:26 +10:00