diff --git a/apps/api/app/schemas/ai_avatar_render.py b/apps/api/app/schemas/ai_avatar_render.py index 338e65264..84761c2f4 100644 --- a/apps/api/app/schemas/ai_avatar_render.py +++ b/apps/api/app/schemas/ai_avatar_render.py @@ -114,7 +114,9 @@ class SmartCoverRequest(BaseModel): video_url: str = Field(..., description="数字人视频 URL(对口型/渲染成片)") max_frames: int = Field(5, ge=1, le=10, description="抽帧数量(默认 5)") - title_config: Optional[dict[str, Any]] = Field(None, description="标题配置;传入时在封面上用 drawtext 叠加标题(竖屏 720x1280)") + title_config: Optional[dict[str, Any]] = Field( + None, description="标题配置;传入时在封面上用 drawtext 叠加标题(竖屏 720x1280)" + ) class SmartCoverResponse(BaseModel): diff --git a/apps/api/app/services/ai_avatar_cover_service.py b/apps/api/app/services/ai_avatar_cover_service.py index a21545544..b109cd079 100644 --- a/apps/api/app/services/ai_avatar_cover_service.py +++ b/apps/api/app/services/ai_avatar_cover_service.py @@ -187,9 +187,12 @@ def apply_title_to_cover(local_frame: str, *, title_config: dict | None) -> str: titled_path = f"{base}_titled{ext or '.jpg'}" cmd = [ "ffmpeg", - "-i", local_frame, - "-vf", drawtext_filter, - "-y", titled_path, + "-i", + local_frame, + "-vf", + drawtext_filter, + "-y", + titled_path, ] logger.info("[数字人封面] 叠加标题: text=%s", text[:30]) result = subprocess.run( diff --git a/apps/api/app/services/ai_avatar_render_service.py b/apps/api/app/services/ai_avatar_render_service.py index 0a5738e9d..92952663c 100644 --- a/apps/api/app/services/ai_avatar_render_service.py +++ b/apps/api/app/services/ai_avatar_render_service.py @@ -449,13 +449,18 @@ class AiAvatarRenderService: elif filter_complex: cmd.extend(["-filter_complex", filter_complex]) - cmd.extend([ - "-c:v", "libx264", - "-preset", "veryfast", - "-crf", "23", - "-y", - output_path, - ]) + cmd.extend( + [ + "-c:v", + "libx264", + "-preset", + "veryfast", + "-crf", + "23", + "-y", + output_path, + ] + ) return cmd def _build_cover_extract_cmd( @@ -477,9 +482,12 @@ class AiAvatarRenderService: cmd: list[str] = [ "ffmpeg", - "-ss", str(timestamp), - "-i", input_video, - "-frames:v", "1", + "-ss", + str(timestamp), + "-i", + input_video, + "-frames:v", + "1", ] if width > 0 and height > 0: vf = (