中文 | English
从长视频中自动抽取高光片段:抽帧 → 逐秒活动强度分析 → 5 秒窗口选段 → 自动倒算剪辑比例 Y → 产出高光集锦。
Python 后端工作流库(vedit)+ WPF(.NET 8)前端面板。
- 逐秒活动强度:ffmpeg 抽灰度帧,计算相邻帧平均像素差作为活动强度
- 5 秒窗口算法:窗口内平均活动强度 > 整体均值 × Y 即保留,相邻保留秒自动合并为片段
- 自动倒算 Y:求最小 Y(步长 0.05)使总时长 ≤ 30 分钟;仅作参考值,可手动修改并实时预览结果时长
- WPF 面板:视频拖放、产品文件夹选择、进度条、实时日志、一键取消
- 产物布局:每个视频独立文件夹(源文件 / 解析报告 / 剪辑结果)
┌──────────────┐ 子进程 python -m vedit.cli ┌──────────────┐
│ WPF 前端 │ ────────────────────────────> │ vedit 后端 │
│ (.NET 8) │ <──── [PROGRESS]/[Y]/[DURATION]│ (纯 Python) │
└──────────────┘ stdout 行协议 └──────────────┘
- 后端
vedit/:与 UI 彻底解耦,无 tkinter/asyncio 依赖core.pyffmpeg 路径解析 / 5 秒窗口算法 / 路径约定analyze.py活动强度计算 + report.htmlplan.py倒算参考 Y / 预览指定 Y 的结果时长export.py用内联 Y 拼接高光集锦cli.py无头运行器(stdout 行协议)
- 前端
VideoEditor.Wpf/:C#/XAML,Process拉起后端,解析[PROGRESS]/[Y]/[DURATION]行驱动进度条、Y 填充、时长显示
剪辑工具/
vedit/ # 后端 Python 工作流库
VideoEditor.Wpf/ # WPF 前端工程(源码)
发布/
需Python版/ # 自包含 .NET + vedit(需系统已装 Python)
内置Python版/ # 自包含 .NET + vedit + 内置解释器(零外部依赖,不入库)
- 运行
发布\<版本>\视频剪辑面板.exe - 选「视频文件」(可直接拖入窗口)
- 选「产品文件夹」
- 「开始分析」:源视频搬入
<产品文件夹>/<视频名>/,跑活动强度 + 报告,倒算参考 Y 自动填入 - 手动修改 Y(可选),点「计算时长」实时预览该 Y 的结果时长
- 「开始剪辑」:用 Y 框的值产出高光集锦
产物布局:
<产品文件夹>/<视频名>/
<视频名>.mp4 # 源文件(面板搬入)
01_解析/ # activity.csv / thumbnails / contact_sheets / report.html
02_剪辑/ # 高光集锦.mp4 + plan.txt(参考Y)
| 版本 | .NET 运行时 | Python | 适用 |
|---|---|---|---|
| 需Python版 | 内置 | 需系统安装(PATH) | 开发机/已有环境 |
| 内置Python版 | 内置 | 内置(零依赖) | 干净机器直接用 |
# 1) 发布 WPF(自包含 .NET)
dotnet publish VideoEditor.Wpf\VideoEditor.Wpf.csproj -c Release -r win-x64 --self-contained true -o <输出目录>
# 2) 拷入 vedit 包
Copy-Item -Recurse vedit <输出目录>\vedit
# 3) 内置 Python 版:再拷入解释器
Copy-Item -Recurse C:\Python314 <输出目录>\python # 或官方 embeddable 版前端通过 python -m vedit.cli <命令> 子进程调用后端,解析 [PROGRESS]/[Y]/[DURATION] 行驱动进度、Y、时长。
Auto-extract highlight segments from long videos: frame sampling → per-second activity analysis → 5-second window segmentation → auto-calculated editing ratio Y → highlight reel.
Python backend workflow library (vedit) + WPF (.NET 8) frontend panel.
- Per-second activity intensity: grayscale frames via ffmpeg, mean pixel diff between adjacent frames
- 5-second window algorithm: keep windows whose mean activity > overall mean × Y; merge adjacent kept seconds
- Auto Y suggestion: minimal Y (step 0.05) so total duration ≤ 30 min — a reference value only; manually adjustable with live duration preview
- WPF panel: video drag & drop, product folder picker, progress bar, live log, cancel
- Output layout: one folder per video (source / analysis report / result)
- Backend
vedit/: fully decoupled from UI (no tkinter/asyncio)core.pyffmpeg resolution / 5s window algorithm / path conventionsanalyze.pyactivity computation + report.htmlplan.pysuggest reference Y / preview duration for a given Yexport.pyconcat highlight reel with inline Ycli.pyheadless runner (stdout line protocol)
- Frontend
VideoEditor.Wpf/: C#/XAML, spawns the backend viaProcess, parses[PROGRESS]/[Y]/[DURATION]lines to drive progress bar, Y field and duration display
- Run
发布\<variant>\视频剪辑面板.exe - Pick a video (or drag it onto the window)
- Pick a product folder
- "开始分析" (Analyze): moves the source into
<product>/<video-name>/, computes activity + report, auto-fills the reference Y - Optionally edit Y, click "计算时长" (Calc duration) to preview the resulting length
- "开始剪辑" (Edit): renders the highlight reel with the Y from the input box
# 1) Publish WPF (self-contained .NET)
dotnet publish VideoEditor.Wpf\VideoEditor.Wpf.csproj -c Release -r win-x64 --self-contained true -o <outdir>
# 2) Copy in the vedit package
Copy-Item -Recurse vedit <outdir>\vedit
# 3) For the bundled variant, also copy a Python interpreter
Copy-Item -Recurse C:\Python314 <outdir>\python # or the official embeddable buildThe frontend calls the backend via python -m vedit.cli <command> and parses [PROGRESS]/[Y]/[DURATION] stdout lines.