refactor: 视频提取日志原地更新,复用 logStreamProgress 模式

- 新增 resetVideoProgress/updateVideoProgress/finishVideoProgress
- 日志面板中视频提取只占一条,实时更新帧数和状态
- 主进程只通过 video:progress IPC 推送原始帧数,不写日志
This commit is contained in:
thzxx
2026-06-18 11:48:35 +08:00
parent abd3dfde72
commit 37189dafa8
3 changed files with 43 additions and 15 deletions
-4
View File
@@ -544,9 +544,6 @@ function extractVideoFrames(filePath: string, maxFrames: number, maxWidth: numbe
try {
await fs.promises.mkdir(tmpDir, { recursive: true });
const fileName = path.basename(filePath);
sendLog('info', `🎬 开始提取视频帧: 1fps`, fileName);
// ffmpeg 提取帧:1fps,同时捕获 stderr 解析进度和视频信息
const outPattern = path.join(tmpDir, 'frame_%04d.jpg');
let ffmpegStderr = '';
@@ -618,7 +615,6 @@ function extractVideoFrames(filePath: string, maxFrames: number, maxWidth: numbe
await fs.promises.rm(tmpDir, { recursive: true, force: true });
sendLog('success', `🎬 视频帧提取完成: 1fps`, `${filePath}${frames.length} 帧 / ${videoInfo.duration.toFixed(1)}s (${videoInfo.width}x${videoInfo.height})`);
resolve({ success: true, frames, videoInfo });
} catch (err) {