feat(music-lab): video.py — Windows에 style/background_mode/tracks 전달 + orchestrator 파라미터 wiring

This commit is contained in:
2026-05-09 13:17:49 +09:00
parent a347da075c
commit 8f859274c4
3 changed files with 54 additions and 3 deletions

View File

@@ -202,12 +202,24 @@ async def _run_video(p, ctx):
vd = setup["visual_defaults"]
audio_path = ctx["audio_path"]
cover_path = _local_path(p["cover_url"])
style = p.get("visual_style") or vd.get("default_visual_style", "essential")
bg_mode = p.get("background_mode") or vd.get("default_background_mode", "static")
bg_path = None
if bg_mode == "video_loop":
loop_local = os.path.join(storage.pipeline_dir(p["id"]), "loop.mp4")
bg_path = loop_local if os.path.isfile(loop_local) else None
out = await asyncio.to_thread(
video.generate,
pipeline_id=p["id"], audio_path=audio_path, cover_path=cover_path,
genre=ctx["genre"],
duration_sec=ctx["duration_sec"],
resolution=vd["resolution"], style=vd["style"],
resolution=vd.get("resolution", "1920x1080"),
style=style,
background_mode=bg_mode,
background_path=bg_path,
tracks=ctx["tracks"] if len(ctx["tracks"]) > 1 else None,
)
return {"next_state": "video_pending", "fields": {"video_url": out["url"]}}
@@ -230,6 +242,7 @@ async def _run_meta(p, ctx, feedback):
"duration_sec": ctx["duration_sec"], "moods": ctx["moods"]},
template=setup["metadata_template"],
trend_keywords=trend_top, feedback=feedback,
tracks=ctx["tracks"] if len(ctx["tracks"]) > 1 else None,
)
return {"next_state": "meta_pending",
"fields": {"metadata_json": json.dumps(out, ensure_ascii=False)}}

View File

@@ -24,7 +24,10 @@ class VideoGenerationError(Exception):
def generate(*, pipeline_id: int, audio_path: str, cover_path: str,
genre: str, duration_sec: int, resolution: str = "1920x1080",
style: str = "visualizer") -> dict:
style: str = "essential",
background_mode: str = "static",
background_path: str | None = None,
tracks: list[dict] | None = None) -> dict:
"""원격 Windows GPU 서버 호출. 다운/실패 시 즉시 예외."""
if not ENCODER_URL:
raise VideoGenerationError(
@@ -35,6 +38,7 @@ def generate(*, pipeline_id: int, audio_path: str, cover_path: str,
nas_audio = _container_to_nas(audio_path)
nas_cover = _container_to_nas(cover_path)
nas_output = _container_to_nas(out_path)
nas_bg = _container_to_nas(background_path) if background_path else None
payload = {
"cover_path_nas": nas_cover,
@@ -43,9 +47,13 @@ def generate(*, pipeline_id: int, audio_path: str, cover_path: str,
"resolution": resolution,
"duration_sec": duration_sec,
"style": style,
"background_mode": background_mode,
"background_path_nas": nas_bg,
"tracks": tracks or [],
}
logger.info("Windows 인코더 호출: pipeline=%d audio=%s", pipeline_id, audio_path)
logger.info("Windows 인코더 호출: pipeline=%d audio=%s style=%s bg_mode=%s",
pipeline_id, audio_path, style, background_mode)
try:
with httpx.Client(timeout=ENCODER_TIMEOUT_S) as client:
resp = client.post(f"{ENCODER_URL}/encode_video", json=payload)