fix(gpu-direct): passthrough template title/subtitle/BGM config (#2093)
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 2s
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 1s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 3s
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Validate - Style (pull_request) Has been skipped
CI/CD Pipeline / Validate - Security (pull_request) Has been skipped
CI/CD Pipeline / Check push changed paths (push) Successful in 13s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Has been skipped
CI/CD Pipeline / Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (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 / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 52s
CI/CD Pipeline / Build Staging API Image (push) Successful in 59s
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 / 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 / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (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 / Canary Release to Production (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m50s
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 55s
CI/CD Pipeline / Build Staging Web Image (push) Successful in 1m32s
CI/CD Pipeline / Retag skipped Staging API Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Has been skipped
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m15s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been skipped
CI/CD Pipeline / Integration Tests (push) Successful in 3m48s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 3m56s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Successful in 1m29s
CI/CD Pipeline / Validate - Style (push) Successful in 4m29s
CI/CD Pipeline / Frontend Unit Tests (push) Failing after 4m33s
CI/CD Pipeline / ACR Image Cleanup (push) Successful in 2m6s
AI Code Review / AI Code Review (pull_request) Successful in 6m56s
CI/CD Pipeline / Staging API Integration Tests (push) Successful in 3m25s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 3m41s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 9m9s
CI/CD Pipeline / PR Build Worker Image (pull_request) Failing after 9m28s
CI/CD Pipeline / CI Gate (pull_request) Failing after 1s
CI/CD Pipeline / Unit Tests (push) Successful in 11m27s
CI/CD Pipeline / Validate - Security (push) Successful in 11m42s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / CI Gate (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Canary Release to Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped

Co-authored-by: xiaoxia <dev@xiaoxiajianji.com>
Co-committed-by: xiaoxia <dev@xiaoxiajianji.com>
This commit was merged in pull request #2093.
This commit is contained in:
2026-09-29 14:54:32 +08:00
committed by auto-approve-bot
parent f9f3e6bfb9
commit da59a6c9a6
3 changed files with 1012 additions and 39 deletions
@@ -2313,17 +2313,37 @@ class UnifiedRenderService:
if bgm_path is not None and not bgm_path.exists():
bgm_path = None
# 字幕:标题 + ASR 时间轴
# 字幕/标题/BGM 配置整包透传
title_cfg = cfg.get("title", {}) or cfg.get("title_config", {}) or {}
if not isinstance(title_cfg, dict):
title_cfg = {}
title_text = ""
if isinstance(title_cfg, dict) and title_cfg.get("enabled", True):
if title_cfg.get("enabled", True):
title_text = title_cfg.get("text", "") or ""
subtitle_segments: list[Any] = []
sub_cfg = cfg.get("subtitle", {}) or {}
if isinstance(sub_cfg, dict) and sub_cfg.get("enabled", True):
if not isinstance(sub_cfg, dict):
sub_cfg = {}
subtitle_segments: list[Any] = []
static_subtitle_text = ""
if sub_cfg.get("enabled", True):
if sub_cfg.get("auto_generated") and self._asr_timeline_cache is not None:
subtitle_segments = list(self._asr_timeline_cache.segments)
else:
# 静态字幕文本(用户手输):pipeline 内部会构造全片长 segment
static_subtitle_text = (sub_cfg.get("text", "") or "").strip()
bgm_cfg = cfg.get("bgm", {}) or {}
if not isinstance(bgm_cfg, dict):
bgm_cfg = {}
# 若 bgm.enabled 显式关闭,则强制 bgm_path=None(_prepare_bgm 已按 enabled 返回 None,双保险)
if not bgm_cfg.get("enabled", True):
bgm_path = None
# 注入微片段 BGM 偏移(同 CPU 路径)
if bgm_path is not None and not bgm_cfg.get("audio_offset"):
_micro_off = self._get_micro_bgm_offset()
if _micro_off:
bgm_cfg = {**bgm_cfg, "audio_offset": _micro_off}
# 边缘裁剪:dedup 开启时在 GPU 内做四边随机 2~5% 裁剪(gpu_direct_pipeline 内部随机)
dedup = self._dedup_enabled()
@@ -2345,6 +2365,31 @@ class UnifiedRenderService:
_vol = float((c.config or {}).get("volume", 1.0))
clip_volumes_list.append(_vol if _vol > 0 else 0.0)
# extra_audio_tracks 音量:从 audio_tracks_config 读(TTS/配音素材库),
# 无法精确匹配 track_id 时保留默认 1.0
at_cfg = cfg.get("audio_tracks") or {}
tts_volume = 1.0
vo_volume = 1.0
if isinstance(at_cfg, dict):
_tracks = at_cfg.get("tracks", []) or []
for _t in _tracks:
if not isinstance(_t, dict):
continue
try:
_vol = float(_t.get("volume", 1.0))
except (TypeError, ValueError):
_vol = 1.0
_tt = str(_t.get("track_type", ""))
if _tt == "voiceover" and _t.get("audio_path"):
vo_volume = max(0.0, min(2.0, _vol))
# TTS 一般没有固定 track_type 标记,保持默认 1.0
extra_audio_tracks_cfg: list[tuple[Any, float]] = []
if tts_merged:
extra_audio_tracks_cfg.append((tts_merged, tts_volume))
if voiceover_track:
extra_audio_tracks_cfg.append((voiceover_track, vo_volume))
plan = gdp.build_direct_render(
resolved_clips=video_clips,
output_width=self.output_width,
@@ -2357,7 +2402,11 @@ class UnifiedRenderService:
total_duration=video_duration,
clip_has_audio=clip_has_audio_list,
clip_volumes=clip_volumes_list,
extra_audio_tracks=extra_audio_tracks,
extra_audio_tracks=extra_audio_tracks_cfg,
title_config=title_cfg,
subtitle_config=sub_cfg,
bgm_config=bgm_cfg,
static_subtitle_text=static_subtitle_text,
)
client = get_gpu_encoder()