feat(cover): 默认本地ffmpeg抽帧+cv2打分,砍掉MediaKit封面路径
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 47s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m17s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m4s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 3m14s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 3m17s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 3m21s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 6m12s
AI Code Review / AI Code Review (pull_request) Successful in 6m46s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 8m7s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / PR Build Worker Image (pull_request) Failing after 9m17s
CI/CD Pipeline / CI Gate (pull_request) Failing after 7s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 6m41s

P1优化:之前封面抽帧走火山MediaKit北京节点(公网拉视频+SceneChange算法+
轮询等待),实测1080p视频耗时86s占总渲染92%。

改动:
1. 默认路径改为本地ffmpeg -ss单帧seek抽取5帧+cv2清晰度/亮度/色彩三维
   评分选最优,预期1-2s完成(本地<100ms/帧×5 + cv2评分0.05s + OSS上传1s)
2. MediaKit路径保留为fallback,配置开关MEDIAKIT_COVER_ENABLED(默认false)
3. 新增clip_boundaries参数:基于clip分段边界取各段中点抽帧,效果优于
   均匀分布;render_adapter自动传入ready_clips的(start_time,duration)
4. 跳过片头8%/片尾8%,避免黑屏/开场logo/片尾字幕区
5. extract_first_frame新增seek_seconds参数支持指定时间点
6. 封面完成日志加elapsed和path字段方便观测耗时
This commit is contained in:
saas-backend-agent
2026-09-28 17:55:39 +08:00
parent c507f76c14
commit d088c80f14
3 changed files with 185 additions and 162 deletions
+15 -1
View File
@@ -650,8 +650,22 @@ class RenderAdapter:
# 已渲染视频在统一渲染阶段已通过 ASS 字幕把标题烧录进画面,
# 抽帧天然带标题,因此这里传空字符串,避免 Pillow 二次叠加导致重影。
# Pillow 叠加仅用于 API 从源素材抽帧(源素材本身无标题)的兜底场景。
# 构造clip分段边界 [(start, duration), ...] 供封面抽帧智能取各段中点
try:
_clip_boundaries = [
(float(getattr(c, "start_time", 0.0) or 0.0), float(getattr(c, "duration", 0.0) or 0.0))
for c in clips
if float(getattr(c, "duration", 0.0) or 0.0) > 0
]
except Exception:
_clip_boundaries = None
cover_candidates = extract_and_upload_cover_frames(
str(result.output_path), plan_id, task_id=job_id, num_frames=5, title_text=""
str(result.output_path),
plan_id,
task_id=job_id,
num_frames=5,
title_text="",
clip_boundaries=_clip_boundaries,
)
if cover_candidates:
logger.info(