refactor: 删除未使用的 MakerNotes Patcher 死代码
删除文件: - HEICMakerNotePatcher.swift (591 行) - MakerNotesPatcher.swift (83 行) 原因: 1. 锁屏壁纸兼容性的根因是 MOV 的 still-image-time(必须为 0), 而非 HEIC 的 MakerNotes 结构 2. 简化版 ContentIdentifier 方案经竞品验证,对 iOS 17+ 有效 3. 复杂的二进制 MakerNote 注入从未被需要 同时在 LivePhotoCore.swift 添加策略说明注释 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,39 @@
|
||||
# Live Photo 无法设置为动态壁纸:根因记录
|
||||
# Live Photo 动态壁纸兼容性:根因与解决方案
|
||||
|
||||
## 现象
|
||||
- 生成的 Live Photo 在相册中可识别、可播放,但在“用作壁纸”时提示“动态不可用”。
|
||||
- 生成的 Live Photo 在相册中可识别、可播放,但在"用作壁纸"时提示"动态不可用"。
|
||||
|
||||
## 关键发现(本地文件元数据)
|
||||
## 根因分析
|
||||
|
||||
### 问题代码(初始版本 299415a)
|
||||
- `Sources/LivePhotoCore/LivePhotoCore.swift` 中 `metadataItemForStillImageTime()` 将 `com.apple.quicktime.still-image-time` 的 value 写成 **-1**(Int8)。
|
||||
- 代码注释错误地认为"竞品使用 0xFF (-1)"——实际上竞品(live-wallpaper)使用的是 **0**。
|
||||
|
||||
### 关键发现
|
||||
- `/Users/yuanjiantsui/Downloads/paired.mov` 中的 timed metadata:`StillImageTime` 为 **-1**(int8)。
|
||||
- `exiftool` 输出示例:`[Track3] StillImageTime : -1`
|
||||
- `exiftool` 输出示例:`[Track3] StillImageTime : -1`
|
||||
|
||||
## 代码根因
|
||||
- `Sources/LivePhotoCore/LivePhotoCore.swift:842`:`LivePhotoBuilder.metadataItemForStillImageTime()` 将 `com.apple.quicktime.still-image-time` 的 value 写成 `-1`。
|
||||
- 建议改为 `0`(int8)。
|
||||
- 仍用 timed metadata group 的 `timeRange.start` 表达关键帧时间。
|
||||
## 解决方案(来自 live-wallpaper 项目)
|
||||
|
||||
## 额外建议(兼容性)
|
||||
- 移除非标准的 mdta keys:`Sample Time` / `Sample Duration`(当前写入到 `assetWriter.metadata`)。
|
||||
- 若仍不兼容,优先尝试 H.264、30fps、SDR、2~3 秒时长作为壁纸兼容模式。
|
||||
### 修复方式(提交 a8b334e)
|
||||
1. **复制 metadata.mov 文件**:从 live-wallpaper 项目复制 `metadata.mov`(MD5: 9c3a827031283513b28844514dbe44d5)
|
||||
2. **采用 metadata track 复制策略**:不再手动创建 still-image-time 元数据,而是从预制的 metadata.mov 复制整个 metadata track
|
||||
|
||||
### live-wallpaper 项目的正确实现
|
||||
- `LivePhotoCreator.swift:52`: `"com.apple.quicktime.still-image-time": 0` // **值为 0,不是 -1**
|
||||
- `LivePhotoCreator.swift:110`: `createMetadataItem(identifier: "com.apple.quicktime.still-image-time", value: 0)`
|
||||
- `Converter4Video.swift:88-187`: 使用 AVAssetReaderTrackOutput + AVAssetWriterInput 复制 metadata track
|
||||
|
||||
### 两个项目的关键对齐点
|
||||
| 特性 | live-wallpaper | to-live-photo(修复后)|
|
||||
|-----|---------------|----------------------|
|
||||
| metadata.mov | ✅ 有 | ✅ 有(同一文件,MD5 相同)|
|
||||
| still-image-time 值 | 0 | 从 metadata.mov 复制(隐式为 0)|
|
||||
| 分辨率策略 | 固定 1080×1920 | 可配置,默认 maxDimension=1920 |
|
||||
| 视频时长 | CMTimeMake(550, 600) ≈ 0.917s | 同 |
|
||||
|
||||
## 技术要点总结
|
||||
|
||||
1. **StillImageTime 必须为 0**:-1 会导致壁纸设置时"动态不可用"
|
||||
2. **metadata track 复制优于手动创建**:预制的 metadata.mov 包含完整的元数据结构,比手动构建更可靠
|
||||
3. **分辨率不是壁纸兼容性的决定因素**:核心问题是元数据格式
|
||||
Reference in New Issue
Block a user