feat: adaptive keyframe count based on video duration

- Replace fixed 5-8 keyframe limit with duration-based adaptive sizing
- Candidate frames: clamp(duration_min × 2, 30, 120)
- Keyframe cap: clamp(duration / 150s, 8, 30)
- 30min video → 12 keyframes (was 8), 60min → 24, 120min → 30
- Short videos (<12min) still get floor of 8 keyframes
- Add Ollama keep-alive config doc to PROGRESS.md (OLLAMA_KEEP_ALIVE=-1)
- Update config.yaml and config.yaml.example with new video params
This commit is contained in:
ericwyuan
2026-08-20 01:29:14 +08:00
parent 40944428d1
commit 727642d38b
5 changed files with 87 additions and 36 deletions

View File

@@ -13,11 +13,15 @@ server:
port: 5000
max_concurrent_tasks: 1
# 关键帧筛选参数
# 关键帧筛选参数(自适应:帧数随视频时长动态计算)
video:
candidate_frames: 30
min_key_frames: 5
max_key_frames: 8
candidate_per_minute: 2 # 每分钟粗抽候选帧数
candidate_min: 30 # 候选帧下限(短视频保底)
candidate_max: 120 # 候选帧上限(超长视频截断)
key_frame_interval_sec: 150 # 关键帧间隔每2.5分钟1张
min_key_frames: 5 # 关键帧下限(帧差不足时补足到此数)
max_key_frames_floor: 8 # 关键帧上限的下限(短视频保底)
max_key_frames_cap: 30 # 关键帧上限(超长视频截断)
mse_threshold: 500
jpeg_quality: 80
max_long_edge: 1024