This commit is contained in:
eric
2026-03-28 17:16:38 -05:00
parent 37ab25911a
commit 46fb194a02
20 changed files with 962 additions and 331 deletions

View File

@@ -146,15 +146,29 @@ def build_profile() -> dict:
def suggest_video_encoder(profile: dict) -> str:
"""在 Linux 上根据 ffmpeg 能力与探测结果给出可选硬件编码器名(供 douyin→YouTube 读取 LIVE_VIDEO_ENCODER"""
"""在 Linux 上根据 ffmpeg 能力与探测结果给出可选硬件编码器名(供 douyin→YouTube 读取 LIVE_VIDEO_ENCODER
优先级RKMPP常见 ARM SoC→ V4L2M2M通用 ARM/部分板)→ VA-APIx86 核显)→ QSVIntel x86
NVIDIA 由 douyin_youtube_ffplay 内单独检测 h264_nvenc此处不重复写入。
"""
if platform.system().lower() != "linux":
return ""
text = run_text(["ffmpeg", "-hide_banner", "-encoders"])
if not text:
return ""
hwaccels = set(profile.get("ffmpeg_hwaccels") or [])
gpu = profile.get("gpu") or {}
render_ok = bool(gpu.get("render_nodes"))
machine = platform.machine().lower()
if "h264_rkmpp" in text and Path("/dev/mpp_service").exists():
return "h264_rkmpp"
if "h264_v4l2m2m" in text and "v4l2m2m" in hwaccels:
return "h264_v4l2m2m"
if "h264_vaapi" in text and render_ok and "vaapi" in hwaccels:
return "h264_vaapi"
if machine in ("x86_64", "amd64") and "h264_qsv" in text:
return "h264_qsv"
return ""