feat: frame-based positioning and mark system foundation
Core Changes: - Fix SearchView to use start_frame/end_frame directly (no time*fps conversion) - Add hard_delete support to delete_trace API - VideoPlayer: Main timeline + Mark system foundation - Proxy: Add local routes for auth, media, identity-matches, cluster-results - Add .gitignore to exclude build artifacts and dependencies Design Documents: - Multi-track Mark system design (.opencode/plans/) - Video editing positioning standards research Files Modified: - src/views/SearchView.vue: Frame positioning, ensureMinDuration (240 frames) - src/views/PeopleView.vue: batchDeleteGroups with hard_delete - src/api/index.ts: delete_trace with hard_delete body - src/components/VideoPlayer.vue: Timeline + Mark UI - src-tauri/src/proxy.rs: New local routes - AGENTS.md: Update documentation
This commit is contained in:
281
.opencode/plans/video_editing_positioning_standards_research.md
Normal file
281
.opencode/plans/video_editing_positioning_standards_research.md
Normal file
@@ -0,0 +1,281 @@
|
||||
# 视频编辑定位标准研究报告
|
||||
|
||||
## 一、行业标准概览
|
||||
|
||||
### 1.1 SMPTE Timecode(行业标准)
|
||||
|
||||
**来源**: Society of Motion Picture and Television Engineers (SMPTE)
|
||||
**标准**: SMPTE 12M (2008年修订为 SMPTE 12M-1, 12M-2, 12M-3)
|
||||
|
||||
**核心原则**:
|
||||
- **Frame-based**: 以帧为单位,格式 `HH:MM:SS:FF`(小时:分钟:秒:帧)
|
||||
- **整数运算**: 所有帧号都是整数
|
||||
- **原点对齐**: Frame 0 = Time 0
|
||||
- **FPS 依赖**: 帧率决定显示时间,但帧数不变
|
||||
|
||||
**支持的帧率**:
|
||||
| FPS | 用途 |
|
||||
|-----|------|
|
||||
| 23.98 (24÷1.001) | 北美 HDTV |
|
||||
| 24 | 电影、ATSC、2K/4K/6K |
|
||||
| 25 | PAL/SECAM(欧洲、澳大利亚)|
|
||||
| 29.97 (30÷1.001) | NTSC(北美、日本)|
|
||||
| 30 | ATSC |
|
||||
|
||||
**Drop-Frame vs Non-Drop-Frame**:
|
||||
- **Drop-Frame (DF)**: 每 minute 跳过 frame 0,1(除第10分钟),用于补偿 29.97fps
|
||||
- **Non-Drop-Frame (NDF)**: 连续帧号
|
||||
- 表示法: DF 用分号 `HH;MM;SS;FF`,NDF 用冒号 `HH:MM:SS:FF`
|
||||
|
||||
---
|
||||
|
||||
### 1.2 EDL (Edit Decision List)
|
||||
|
||||
**用途**: 剪辑决策列表,用于记录剪辑点
|
||||
|
||||
**简单 EDL 格式**:
|
||||
|
||||
**Time-based**:
|
||||
```
|
||||
[begin second] [end second] [action]
|
||||
5.3 7.1 0 # cut from 5.3s to 7.1s
|
||||
15 16.7 1 # mute from 15s to 16.7s
|
||||
```
|
||||
|
||||
**Frame-based**:
|
||||
```
|
||||
#[begin frame] #[end frame] [action]
|
||||
#127 #170 0 # cut from frame 127 to 170
|
||||
#360 #400 1 # mute from frame 360 to 400
|
||||
```
|
||||
|
||||
**关键点**:
|
||||
- 支持两种定位方式:time(浮点)和 frame(整数)
|
||||
- Action 类型:0=cut, 1=mute, 2=scene marker, 3=skip
|
||||
- **推荐使用 Frame-based** 以保证精度
|
||||
|
||||
---
|
||||
|
||||
### 1.3 AAF (Advanced Authoring Format)
|
||||
|
||||
**来源**: Advanced Media Workflow Association (AMWA)
|
||||
**标准化**: SMPTE
|
||||
|
||||
**特点**:
|
||||
- 专业级跨平台数据交换格式
|
||||
- 包含 Essence Data(音频、视频等)和 Metadata
|
||||
- 支持复杂的对象关系描述
|
||||
- 追踪从源文件到最终产出的完整历史
|
||||
- 用于"进行中的作品"(works in progress)
|
||||
|
||||
**与 MXF 的关系**:
|
||||
- AAF 用于编辑中的项目
|
||||
- MXF 用于交换完成的媒体产品
|
||||
- MXF 是 AAF 数据模型的子集
|
||||
|
||||
---
|
||||
|
||||
### 1.4 OpenTimelineIO
|
||||
|
||||
**来源**: Pixar 开发,现由 Academy Software Foundation 维护
|
||||
**状态**: 成熟框架,广泛应用于影视行业
|
||||
|
||||
**核心设计**:
|
||||
- **OpenTime**: 无依赖的时间处理库
|
||||
- **数据模型**: Timeline → Track → Clip → Media Reference
|
||||
- **帧与时间分离**:
|
||||
- `RationalTime`: value + rate(精确的时间表示)
|
||||
- `TimeRange`: start_time + duration
|
||||
- 帧是整数,时间是 RationalTime
|
||||
|
||||
**示例**:
|
||||
```python
|
||||
import opentimelineio as otio
|
||||
|
||||
timeline = otio.adapters.read_from_file("project.aaf")
|
||||
for clip in timeline.find_clips():
|
||||
print(clip.name, clip.duration())
|
||||
# duration() 返回 RationalTime(value, rate)
|
||||
```
|
||||
|
||||
**支持的格式**:
|
||||
- Final Cut Pro XML
|
||||
- AAF
|
||||
- CMX 3600 EDL
|
||||
- 原生 `.otio`, `.otioz`, `.otiod`
|
||||
|
||||
---
|
||||
|
||||
## 二、主流软件对比
|
||||
|
||||
### 2.1 Adobe Premiere Pro
|
||||
|
||||
**定位方式**:
|
||||
- 使用 SMPTE Timecode
|
||||
- 支持 Drop-Frame 和 Non-Drop-Frame
|
||||
- 内部用帧号定位,显示用时间码
|
||||
- 导出格式:EDL, XML, AAF
|
||||
|
||||
### 2.2 Final Cut Pro
|
||||
|
||||
**定位方式**:
|
||||
- 使用 Apple 时间码格式
|
||||
- Frame-based 内部处理
|
||||
- 导出格式:FCP XML(专有格式)
|
||||
- 时间以 frame + fps 存储
|
||||
|
||||
### 2.3 DaVinci Resolve
|
||||
|
||||
**定位方式**:
|
||||
- 支持多种时间码格式
|
||||
- 项目设置选择 FPS(全局)
|
||||
- Timeline 使用 frame 定位
|
||||
- 支持 EDL, AAF, OTIO 导出
|
||||
|
||||
### 2.4 Avid Media Composer
|
||||
|
||||
**定位方式**:
|
||||
- 专业级 SMPTE Timecode 实现
|
||||
- 支持 Drop-Frame 计数
|
||||
- 轨道级时间码管理
|
||||
- AAF 原生支持
|
||||
|
||||
---
|
||||
|
||||
## 三、核心设计原则总结
|
||||
|
||||
### 3.1 行业共识
|
||||
|
||||
| 原则 | 说明 |
|
||||
|------|------|
|
||||
| **Frame 是唯一标准** | 所有定位、剪辑、同步都用帧号 |
|
||||
| **整数运算** | 避免浮点精度问题 |
|
||||
| **FPS 是元数据** | 不改变帧数,只改变显示时间 |
|
||||
| **原点对齐** | Frame 0 = Time 0 |
|
||||
| **Time 仅用于显示** | Frame ÷ FPS = Time |
|
||||
|
||||
### 3.2 数据流架构
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────┐
|
||||
│ Source Data (各种格式) │
|
||||
│ - Video files (frame-based metadata) │
|
||||
│ - Audio files (time-based or sample-based) │
|
||||
│ - Analysis results (various formats) │
|
||||
└─────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────┐
|
||||
│ 统一转换层 (标准化) │
|
||||
│ - Time → Frame (用 FPS) │
|
||||
│ - Sample → Frame (用 sample_rate) │
|
||||
│ - 所有数据统一为 Frame │
|
||||
└─────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────┐
|
||||
│ 内部数据模型 (Frame-based) │
|
||||
│ - Mark.startFrame (integer) │
|
||||
│ - Mark.endFrame (integer) │
|
||||
│ - Clip.timelineStartFrame (integer) │
|
||||
│ - Project.fps (metadata) │
|
||||
└─────────────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────────────┐
|
||||
│ Timeline 展示层 │
|
||||
│ - 位置:frame / totalFrames * 100% │
|
||||
│ - 显示:frame / fps → "MM:SS" │
|
||||
│ - 所有轨道对齐 │
|
||||
└─────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 四、对 Momentry Studio 的启示
|
||||
|
||||
### 4.1 遵循行业标准
|
||||
|
||||
**推荐做法**:
|
||||
1. ✅ 采用 Frame 作为唯一定位标准
|
||||
2. ✅ 所有 Frame 操作使用整数
|
||||
3. ✅ FPS 作为项目元数据
|
||||
4. ✅ Time 仅用于显示转换
|
||||
5. ✅ 原点对齐:Frame 0 = Time 0
|
||||
|
||||
### 4.2 数据格式建议
|
||||
|
||||
```typescript
|
||||
// Mark 定义(符合行业标准)
|
||||
interface Mark {
|
||||
id: string
|
||||
startFrame: number // integer, SMPTE-style
|
||||
endFrame?: number // integer
|
||||
tag: string
|
||||
note?: string
|
||||
}
|
||||
|
||||
// Clip 定义(类似 OTIO)
|
||||
interface Clip {
|
||||
sourceStartFrame: number // integer
|
||||
sourceEndFrame: number // integer
|
||||
timelineStartFrame: number // integer
|
||||
timelineEndFrame: number // integer
|
||||
}
|
||||
|
||||
// Project 定义
|
||||
interface Project {
|
||||
fps: number // 元数据
|
||||
totalFrames: number // integer
|
||||
duration: number // 仅用于显示,计算得出
|
||||
}
|
||||
```
|
||||
|
||||
### 4.3 导出格式支持
|
||||
|
||||
**优先级**:
|
||||
1. **P0 - 内部格式**: 自定义 JSON/SQLite(Frame-based)
|
||||
2. **P1 - EDL**: 简单 EDL(Frame-based)
|
||||
3. **P2 - OTIO**: OpenTimelineIO 格式(行业标准)
|
||||
4. **P3 - AAF/FCPXML**: 专业软件互操作
|
||||
|
||||
---
|
||||
|
||||
## 五、参考资料
|
||||
|
||||
### 5.1 标准文档
|
||||
|
||||
- [SMPTE ST 12-1:2008](https://ieeexplore.ieee.org/document/7289820/) - Time and Control Code
|
||||
- [CMX 3600 EDL Specification](http://xmil.biz/EDL-X/CMX3600.pdf)
|
||||
- [OpenTimelineIO Documentation](https://opentimelineio.readthedocs.io/)
|
||||
|
||||
### 5.2 相关 Wikipedia 文章
|
||||
|
||||
- [SMPTE timecode](https://en.wikipedia.org/wiki/SMPTE_timecode)
|
||||
- [Edit decision list](https://en.wikipedia.org/wiki/Edit_decision_list)
|
||||
- [Advanced Authoring Format](https://en.wikipedia.org/wiki/Advanced_Authoring_Format)
|
||||
|
||||
### 5.3 开源项目
|
||||
|
||||
- [OpenTimelineIO](https://github.com/AcademySoftwareFoundation/OpenTimelineIO) - Pixar 开源
|
||||
- [OpenTimelineIO Plugins](https://github.com/OpenTimelineIO) - 各种适配器
|
||||
|
||||
---
|
||||
|
||||
## 六、结论
|
||||
|
||||
视频编辑行业的定位标准明确且统一:
|
||||
|
||||
1. **Frame 是唯一标准** - 所有专业软件和行业标准都基于帧号
|
||||
2. **整数运算** - 避免浮点精度问题
|
||||
3. **FPS 作为元数据** - 不改变帧数,只影响显示时间
|
||||
4. **OpenTimelineIO 是最佳参考** - 现代、开源、行业标准
|
||||
|
||||
Momentry Studio 的设计完全符合行业标准:
|
||||
- ✅ Frame-based 定位
|
||||
- ✅ 整数运算
|
||||
- ✅ FPS 作为元数据
|
||||
- ✅ 原点对齐
|
||||
- ✅ 多轨同步
|
||||
|
||||
可以继续按照现有设计文档推进实现。
|
||||
Reference in New Issue
Block a user