# yishunzhikong/live_recorder architecture

> Architecture diagram of the GitHub repository yishunzhikong/live_recorder, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yishunzhikong/live_recorder
- Repository: https://github.com/yishunzhikong/live_recorder

## Overview

Live Recorder 是一款 WinUI 3 桌面媒体下载与直播录制工具，提供直链录制/下载和 yt-dlp 网页分析两种入口。用户可预览媒体、录制并在断流时重连，随后合并分片或转码；另有工具升级、编码选项及便携配置与日志。图中调用关系依据所示源码引用索引和 README；未展示的分支仅保留文档明确的能力，不推断其内部调用。

Main entry points: [`src/LiveRecorder.Core/MediaService.cs`](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/MediaService.cs) (媒体服务), [`src/LiveRecorder.Core/ToolUpdater.cs`](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/ToolUpdater.cs) (工具升级), [`src/LiveRecorder.Core/MediaService.Recording.cs`](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/MediaService.Recording.cs) (直播录制), [`src/LiveRecorder.Core/WebVideoAnalyzer.cs`](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/WebVideoAnalyzer.cs) (网页视频分析)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["桌面交互"]
  node_window["主窗口<br/>[MainWindow.xaml.cs]"]
  node_playback["播放交互"]
  node_webui["网页模式"]
  node_options["选项设置"]
  node_toolui["工具管理界面"]
  node_versions["版本管理对话框"]
end

subgraph group_media["媒体处理"]
  node_media["媒体服务<br/>[MediaService.cs]"]
  node_recording["直播录制"]
  node_parts["录制分片<br/>[RecordingParts.cs]"]
  node_encoding["编码策略"]
  node_preview["预览流进程<br/>[PreviewStream.cs]"]
  node_ffmpeg["FFmpeg进程<br/>[FfmpegProcess.cs]"]
end

subgraph group_tools["工具与网页"]
  node_analyzer["网页视频分析"]
  node_updater["工具升级<br/>[ToolUpdater.cs]"]
  node_toolprocess["工具进程环境<br/>[ToolProcess.cs]"]
end

subgraph group_state["配置与状态"]
  node_storage["便携存储<br/>[PortableStorage.cs]"]
  node_configuration[("应用配置")]
  node_log[("日志<br/>[PortableLog.cs]")]
  node_mutex["文件互斥"]
end

node_user(("用户"))
node_github{{"GitHub发布服务"}}

node_user -->|"操作"| node_window
node_window -->|"下载录制合并"| node_media
node_playback -->|"调用媒体操作"| node_media
node_playback -->|"启动预览"| node_preview
node_webui -->|"分析网页"| node_analyzer
node_webui -->|"下载或预览"| node_media
node_options -->|"读取设置"| node_storage
node_toolui -->|"升级工具"| node_updater
node_toolui -->|"刷新媒体工具"| node_media
node_versions -->|"管理版本"| node_updater
node_media -->|"执行录制"| node_recording
node_recording -->|"写入分片"| node_parts
node_recording -->|"读取编码策略"| node_encoding
node_media -->|"应用编码策略"| node_encoding
node_media -->|"运行媒体任务"| node_ffmpeg
node_recording -->|"运行录制任务"| node_ffmpeg
node_ffmpeg -->|"创建进程"| node_toolprocess
node_analyzer -->|"创建分析进程"| node_toolprocess
node_analyzer -->|"提供音频预览流"| node_preview
node_updater -->|"配置运行环境"| node_toolprocess
node_updater -->|"读取工具设置"| node_configuration
node_updater -->|"查询并下载发行版"| node_github
node_storage -->|"初始化配置"| node_configuration
node_storage -->|"配置日志"| node_log
node_configuration -->|"同步配置文件"| node_mutex

click node_window "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.xaml.cs"
click node_playback "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.Playback.cs"
click node_webui "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.WebVideo.cs"
click node_options "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.Options.cs"
click node_toolui "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.Tools.cs"
click node_versions "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/ToolVersionsDialog.xaml.cs"
click node_media "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/MediaService.cs"
click node_recording "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/MediaService.Recording.cs"
click node_parts "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/RecordingParts.cs"
click node_encoding "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/EncodingSettings.cs"
click node_preview "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/PreviewStream.cs"
click node_ffmpeg "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/FfmpegProcess.cs"
click node_analyzer "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/WebVideoAnalyzer.cs"
click node_updater "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/ToolUpdater.cs"
click node_toolprocess "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/ToolProcess.cs"
click node_storage "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/PortableStorage.cs"
click node_configuration "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/PortableConfiguration.cs"
click node_log "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/PortableLog.cs"
click node_mutex "https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/PortableFileMutex.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_window,node_playback,node_webui,node_options,node_toolui,node_versions toneBlue
class node_media,node_recording,node_parts,node_encoding,node_preview,node_ffmpeg toneAmber
class node_analyzer,node_updater,node_toolprocess toneMint
class node_storage,node_configuration,node_log,node_mutex toneRose
class node_user,node_github toneIndigo
```

## Components

### 桌面交互

- [主窗口](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.xaml.cs): `src/LiveRecorder/MainWindow.xaml.cs`
- [播放交互](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.Playback.cs): `src/LiveRecorder/MainWindow.Playback.cs`
- [网页模式](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.WebVideo.cs): `src/LiveRecorder/MainWindow.WebVideo.cs`
- [选项设置](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.Options.cs): `src/LiveRecorder/MainWindow.Options.cs`
- [工具管理界面](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/MainWindow.Tools.cs): `src/LiveRecorder/MainWindow.Tools.cs`
- [版本管理对话框](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/ToolVersionsDialog.xaml.cs): `src/LiveRecorder/ToolVersionsDialog.xaml.cs`

### 媒体处理

- [媒体服务](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/MediaService.cs): `src/LiveRecorder.Core/MediaService.cs`
- [直播录制](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/MediaService.Recording.cs): `src/LiveRecorder.Core/MediaService.Recording.cs`
- [录制分片](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/RecordingParts.cs): `src/LiveRecorder.Core/RecordingParts.cs`
- [编码策略](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/EncodingSettings.cs): `src/LiveRecorder.Core/EncodingSettings.cs`
- [预览流进程](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/PreviewStream.cs): `src/LiveRecorder.Core/PreviewStream.cs`
- [FFmpeg进程](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/FfmpegProcess.cs): `src/LiveRecorder.Core/FfmpegProcess.cs`

### 工具与网页

- [网页视频分析](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/WebVideoAnalyzer.cs): `src/LiveRecorder.Core/WebVideoAnalyzer.cs`
- [工具升级](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/ToolUpdater.cs): `src/LiveRecorder.Core/ToolUpdater.cs`
- [工具进程环境](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/ToolProcess.cs): `src/LiveRecorder.Core/ToolProcess.cs`

### 配置与状态

- [便携存储](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder/PortableStorage.cs): `src/LiveRecorder/PortableStorage.cs`
- [应用配置](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/PortableConfiguration.cs): `src/LiveRecorder.Core/PortableConfiguration.cs`
- [日志](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/PortableLog.cs): `src/LiveRecorder.Core/PortableLog.cs`
- [文件互斥](https://github.com/yishunzhikong/live_recorder/blob/main/src/LiveRecorder.Core/PortableFileMutex.cs): `src/LiveRecorder.Core/PortableFileMutex.cs`

### Other components

- **用户**
- **GitHub发布服务**

## Connections

- 用户 → 主窗口: 操作 (evidence: `README.md`)
- 主窗口 → 媒体服务: 下载录制合并 (evidence: `src/LiveRecorder/MainWindow.xaml.cs`)
- 播放交互 → 媒体服务: 调用媒体操作 (evidence: `src/LiveRecorder/MainWindow.Playback.cs`)
- 播放交互 → 预览流进程: 启动预览 (evidence: `src/LiveRecorder/MainWindow.Playback.cs`)
- 网页模式 → 网页视频分析: 分析网页 (evidence: `src/LiveRecorder/MainWindow.WebVideo.cs`)
- 网页模式 → 媒体服务: 下载或预览 (evidence: `src/LiveRecorder/MainWindow.WebVideo.cs`)
- 选项设置 → 便携存储: 读取设置 (evidence: `src/LiveRecorder/MainWindow.Options.cs`)
- 工具管理界面 → 工具升级: 升级工具 (evidence: `src/LiveRecorder/MainWindow.Tools.cs`)
- 工具管理界面 → 媒体服务: 刷新媒体工具 (evidence: `src/LiveRecorder/MainWindow.Tools.cs`)
- 版本管理对话框 → 工具升级: 管理版本 (evidence: `src/LiveRecorder/ToolVersionsDialog.xaml.cs`)
- 媒体服务 → 直播录制: 执行录制 (evidence: `src/LiveRecorder.Core/MediaService.cs`)
- 直播录制 → 录制分片: 写入分片 (evidence: `src/LiveRecorder.Core/MediaService.Recording.cs`)
- 直播录制 → 编码策略: 读取编码策略 (evidence: `src/LiveRecorder.Core/MediaService.Recording.cs`)
- 媒体服务 → 编码策略: 应用编码策略 (evidence: `src/LiveRecorder.Core/MediaService.cs`)
- 媒体服务 → FFmpeg进程: 运行媒体任务 (evidence: `src/LiveRecorder.Core/MediaService.cs`)
- 直播录制 → FFmpeg进程: 运行录制任务 (evidence: `src/LiveRecorder.Core/MediaService.Recording.cs`)
- FFmpeg进程 → 工具进程环境: 创建进程 (evidence: `src/LiveRecorder.Core/FfmpegProcess.cs`)
- 网页视频分析 → 工具进程环境: 创建分析进程 (evidence: `src/LiveRecorder.Core/WebVideoAnalyzer.cs`)
- 网页视频分析 → 预览流进程: 提供音频预览流 (evidence: `src/LiveRecorder.Core/WebVideoAnalyzer.cs`)
- 工具升级 → 工具进程环境: 配置运行环境 (evidence: `src/LiveRecorder.Core/ToolUpdater.cs`)
- 工具升级 → 应用配置: 读取工具设置 (evidence: `src/LiveRecorder.Core/ToolUpdater.cs`)
- 工具升级 → GitHub发布服务: 查询并下载发行版 (evidence: `README.md`)
- 便携存储 → 应用配置: 初始化配置 (evidence: `src/LiveRecorder/PortableStorage.cs`)
- 便携存储 → 日志: 配置日志 (evidence: `src/LiveRecorder/PortableStorage.cs`)
- 应用配置 → 文件互斥: 同步配置文件 (evidence: `src/LiveRecorder.Core/PortableConfiguration.cs`)
