's'
This commit is contained in:
@@ -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-API(x86 核显)→ QSV(Intel 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 ""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user