3ff45f983e
研究目標: - 評估使用 Apple native video API 替代 ffmpeg 的可行性 - 利用 Apple Vision + ANE 加速 實現方案: - 方案 A: Swift 幀差異法 (已實現原型) - 方案 B: Vision + Core ML (ANE 加速) - 方案 C: Metal GPU 加速 原型實現: - swift_scene_detector: AVFoundation + Core Image - 功能: 場景檢測 - 測試: ✅ 成功 技術: - AVAssetReader: 視頻幀提取 - Core Image: 幀差異計算 - CIDifferenceBlendMode: 差異混合 測試結果: - Duration: 8.8s, FPS: 60.0, Frames: 529 - Detected: 1 scene - ✅ 原型驗證成功 優勢: - ✅ Apple native 實現 - ✅ 無外部依賴 - ✅ GPU 加速 (Core Image) - ⚠️ 準確性待優化 下一步: - 優化算法 (提高準確性) - 性能對比 (vs ffmpeg) - 考慮方案 B (Vision + Core ML)
17 lines
399 B
Swift
17 lines
399 B
Swift
// swift-tools-version:5.9
|
|
import PackageDescription
|
|
|
|
let package = Package(
|
|
name: "swift_processors",
|
|
platforms: [.macOS(.v12)],
|
|
products: [
|
|
.executable(name: "swift_scene_detector", targets: ["swift_scene_detector"]),
|
|
],
|
|
targets: [
|
|
.executableTarget(
|
|
name: "swift_scene_detector",
|
|
path: "Sources/swift_scene_detector"
|
|
),
|
|
]
|
|
)
|