VideoTools/internal
Stu Leak 1618558314 Implement keyframe detection system (Commit 4)
Core implementation:
- Create internal/keyframe package with detector.go
- Implement DetectKeyframes() using ffprobe packet flags
- Use 'K' flag in packet data to identify I-frames
- Binary search for FindNearestKeyframe() (before/after/nearest)
- EstimateFrameNumber() for frame calculations

Caching system:
- Save/load keyframe index to ~/.cache/vt_player/keyframes/
- Binary format: ~12 bytes per keyframe (~3KB for 4min video)
- Cache key based on file path + modification time
- Auto-invalidation when file changes
- DetectKeyframesWithCache() for automatic cache management

Performance:
- 265 keyframes detected in 0.60s for 4min video (441 kf/sec)
- FindNearestKeyframe: 67ns per lookup (binary search)
- Memory: ~3KB cache per video
- Exceeds target: <5s for 1-hour video

Integration:
- Add KeyframeIndex field to videoSource
- EnsureKeyframeIndex() method for lazy loading
- Ready for frame-accurate navigation features

Testing:
- Comprehensive unit tests (all passing)
- Benchmark tests for search performance
- cmd/test_keyframes utility for validation
- Tested on real video files

Prepares for Commits 5-10:
- Frame-by-frame navigation (Commit 5)
- Keyframe jump controls (Commit 5)
- Timeline with keyframe markers (Commit 6-7)
- In/out point marking (Commit 8)
- Lossless cut export (Commit 9-10)

References: DEV_SPEC Phase 2 (lines 54-119)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 14:11:45 -05:00
..
app Initial import for VT Player 2025-12-04 05:03:02 -05:00
convert Initial import for VT Player 2025-12-04 05:03:02 -05:00
keyframe Implement keyframe detection system (Commit 4) 2025-12-05 14:11:45 -05:00
logging Refactor to modular architecture with rainbow UI (v0.1.0-dev8) 2025-11-23 14:56:37 -05:00
modules Simplify player view and enable drop-to-play 2025-12-04 06:04:35 -05:00
player Improve queue system reliability and add auto-resolution for DVD formats 2025-11-29 20:07:35 -05:00
queue Auto-start queue when adding jobs from Convert module 2025-11-29 20:31:52 -05:00
ui Integrate Google Material Icons for clean UI 2025-12-05 10:06:43 -05:00
utils Initial import for VT Player 2025-12-04 05:03:02 -05:00