Desktop Features
Desktop (Electron) specific features and architecture.
🖥️ Complete Desktop Workflow (Download-Create-Encode)
Desktop-exclusive complete workflow from source acquisition to final output:
🚀 Full-Auto End-to-End Mode
This is an Electron-exclusive core feature, coordinating Main Process (resource scheduling) and Renderer Process (AI computation) via IPC for "one-click hardsub".
Cross-Process Interaction Architecture
Key IPC Channels
| Channel | Direction | Payload | Purpose |
|---|---|---|---|
end-to-end:start | Renderer -> Main | EndToEndConfig | Start full-auto task |
end-to-end:generate-subtitles | Main -> Renderer | path, config | Main ready, request generation |
end-to-end:subtitle-result | Renderer -> Main | SubtitleItem[] | Generation complete, return result |
end-to-end:progress | Main -> Renderer | stage, progress | Real-time progress sync |
🛰️ Custom Media Protocol
To bypass browser security restrictions (CSP, sandbox) and support large file streaming:
local-video:// Protocol
- Location:
electron/main.ts - Core Permissions:
standard,secure,stream,supportFetchAPI,bypassCSP - Key Tech - Tailing Reader: Supports reading "growing files" (transcoding in progress). Uses polling to read new data FFmpeg is writing to disk.
📺 Video Preview & Cache Strategy
System uses fragmented MP4 (fMP4) transcoding strategy for progressive playback during transcoding.
Architecture Overview
| Component | Location | Function |
|---|---|---|
VideoPlayerPreview | src/components/editor/ | React player, ASS subtitle overlay |
useVideoPreview | src/hooks/ | Transcode progress, video source, state |
videoPreviewTranscoder | electron/services/ | FFmpeg transcoding, GPU accel, caching |
Flow Diagram
Core Features
| Feature | Description |
|---|---|
| Progressive Play | Play before transcoding completes via fMP4 + Tailing |
| GPU Acceleration | Auto-detect NVENC/QSV/VCE for faster transcoding |
| Format Detection | Skip transcoding for browser-compatible formats |
| WYSIWYG Subtitles | Real-time ASS rendering with assjs |
| Float/Dock Mode | Resizable floating window or docked panel |
Cache Lifecycle
- Location: User data directory (
/preview_cache/) - Limit: Auto-enforce total size limit (default 3GB)
- Cleanup: Auto-detect on startup (oldest first), UI manual cleanup
IPC Channels
| Channel | Direction | Payload | Purpose |
|---|---|---|---|
transcode-for-preview | Renderer → Main | { filePath } | Request video transcoding |
transcode-start | Main → Renderer | { outputPath, duration } | Transcoding started |
transcode-progress | Main → Renderer | { percent, transcodedDuration } | Real-time progress |
cache:get-size | Renderer → Main | - | Get preview cache size |
cache:clear | Renderer → Main | - | Clear preview cache |
🔧 Desktop Service Modules
| File | Description |
|---|---|
main.ts | Electron main process, window & IPC |
preload.ts | Preload script, secure Node.js API exposure |
logger.ts | Unified logging, file rotation, JSON view |
utils/paths.ts | Portable path resolution, exe-relative storage |
services/localWhisper.ts | Local Whisper, GPU detection |
services/ffmpegAudioExtractor.ts | FFmpeg audio extraction |
services/ytdlp.ts | Video download (YouTube/Bilibili) |
services/videoCompressor.ts | Video encoding, NVENC/QSV/AMF acceleration |
services/videoPreviewTranscoder.ts | Preview transcoding, fMP4, caching |
services/endToEndPipeline.ts | Full automation pipeline |
services/storage.ts | Portable storage, exe-relative config/logs |