feat(worker): 全GPU直连渲染,取消mezzanine CPU中间编码 #2086
Reference in New Issue
Block a user
Delete Branch "feature/gpu-direct-pipeline"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
mezzanine CPU(libx264) 编码 85s 是当前最大瓶颈,另含边缘裁剪重编码 26s、音视频合成 2s、mezzanine 中转 1s,合计约 114s。
方案
P4000 已确认是通用 ffmpeg 执行器(任意 inputs + ffmpeg_args + filter_complex),无需改服务端。worker 直接把原始素材签名URL + TTS + BGM 作为 inputs 发 P4000
/api/render/sync,filter_complex 一条命令完成:trim/setpts/倍速 → scale+pad 适配 → concat 拼接 → 随机边缘 crop+scale → drawtext 标题/ASR字幕 → amix(TTS+BGM) → h264_nvenc 仅编码一次。
改动
packages/shared/gpu_encoder.py:新增render_inputs_to_output(inputs, ffmpeg_args, output_path),成片走 relay 回传。apps/worker/video_processing/gpu_direct_pipeline.py(新):URL签名、drawtext转义、DirectRenderPlan 构造。unified_render_service.py:render() 步骤4.8 接入;新增_can_use_gpu_direct/_try_gpu_direct/_concat_audio_clips。render_adapter.py:透传 asset_storage_map,给 clip 注入_storage_key。安全回退
直连仅命中:单一主视频轨、全硬切、无 PiP/水印/贴纸/片头片尾/绿幕/倒放/调色。任一不满足、或 GPU 调用失败,自动返回 None 走现有链路,功能不回归。可用 plan config
gpu_direct_enabled=false灰度关闭。待办(不阻塞本PR)
🚀 预览环境已部署
🗑️ 预览环境已清理
PR #2086 已关闭或合并,对应的预览环境已被清理。